I have a bunch of unit test files in a Rails project. One of them has
stopped using the setup method before each test, or even if I invoke it
in the test itself.
After commenting out most of it, here is what is left:
require ''test/test_helper''
class GlcTest < ActiveSupport::TestCase
def setup
p ''###########################''
end
def test_setup
p ''[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[''
setup
end
end
The file I am testing is glc.rb, and that does get loaded. If I run the
test file, it does work normally; this is a problem when running the
test through rake (either via my IDE or at the command line).
test_setup does get invoked, so the file is being processed. I am
guessing that somewhere there is another setup method that takes
priority, but where would it be, and why does it take priority over this
one? My IDE recognises that this setup overrides the one in
ActiveSupport::TestCase.
There is no setup method defined in glc.rb, and as the problem is
isolated to this one class, I am mystified as to where this other setup
might be.
Any advice appreciated.
Using JRuby 1.5 on Windows, by the way.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
On 20 July 2010 15:57, Andy Joel <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I have a bunch of unit test files in a Rails project. One of them has > stopped using the setup method before each test, or even if I invoke it > in the test itself. > > After commenting out most of it, here is what is left: > > require ''test/test_helper'' > > class GlcTest < ActiveSupport::TestCase > def setup > p ''###########################'' > end > > def test_setup > p ''[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[''You could put a debugger statement here then step in to see where it goes Colin> setup > end > end > > The file I am testing is glc.rb, and that does get loaded. If I run the > test file, it does work normally; this is a problem when running the > test through rake (either via my IDE or at the command line). > > test_setup does get invoked, so the file is being processed. I am > guessing that somewhere there is another setup method that takes > priority, but where would it be, and why does it take priority over this > one? My IDE recognises that this setup overrides the one in > ActiveSupport::TestCase. > > There is no setup method defined in glc.rb, and as the problem is > isolated to this one class, I am mystified as to where this other setup > might be. > > Any advice appreciated. > > Using JRuby 1.5 on Windows, by the way. > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jul 20, 3:57 pm, Andy Joel <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> > test_setup does get invoked, so the file is being processed. I am > guessing that somewhere there is another setup method that takes > priority, but where would it be, and why does it take priority over this > one? My IDE recognises that this setup overrides the one in > ActiveSupport::TestCase. >is it possible that another of your test cases is also called GlcTest ? Fred -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung wrote:> On Jul 20, 3:57�pm, Andy Joel <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: >> >> test_setup does get invoked, so the file is being processed. I am >> guessing that somewhere there is another setup method that takes >> priority, but where would it be, and why does it take priority over this >> one? My IDE recognises that this setup overrides the one in >> ActiveSupport::TestCase. >> > > is it possible that another of your test cases is also called > GlcTest ? > > FredThat was it. I had copy-and-pasted from GlcTest to create a new test class, and had forgotten to change the class name. Thanks for the help. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.