HI all
If I have two functional tests that test the same controller, I get
fixture errors. Is this right?
here is one
require File.dirname(__FILE__) + ''/../test_helper''
require ''summary_controller''
# Re-raise errors caught by the controller.
class SummaryController; def rescue_action(e) raise e end; end
class SummaryControllerTest < Test::Unit::TestCase
all_fixtures
and here is the other
require File.dirname(__FILE__) + ''/../test_helper''
require ''summary_controller''
# Re-raise errors caught by the controller.
class SummaryController; def rescue_action(e) raise e end; end
class SummaryControllerTest < Test::Unit::TestCase
fixtures :users, :decisions, :roles
Here is the error it produces...
1) Error:
test_choose_chart(SummaryControllerTest):
NoMethodError: You have a nil object when you didn''t expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.[]
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/fixture
s.rb:498:in `users''
./test/functional/summary_controller_test.rb:42:in
`test_choose_chart''
c:/ruby/lib/ruby/gems/1.8/gems/mocha-0.5.5/lib/mocha/test_case_adapter.rb:19
:in `__send__''
c:/ruby/lib/ruby/gems/1.8/gems/mocha-0.5.5/lib/mocha/test_case_adapter.rb:19
:in `run''
on this line:
admin = users(:admin)
Have any of you run into a similar problem before?
--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
I haven''t looked into it in any depth, but I wonder if your problem could be that your test classes have exactly the same name. So when the second file is loaded, you will be modifying the first test class. -- James. http://blog.floehopper.org http://tumble.floehopper.org --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
James Mead wrote:> I haven''t looked into it in any depth, but I wonder if your problem > could be that your test classes have exactly the same name. So when > the second file is loaded, you will be modifying the first test class. > -- > James. > http://blog.floehopper.org > http://tumble.floehopper.orgThat turned out to be the issue. Apprently you cannot do that in tests apparently, have the same controller being tested. I dunno why but deleting one fixed the problem. Thanks! -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I suspect you *can* have two test cases testing the same controller as long as the class names of the two *TestCases* are different. class SummaryControllerOneTest < Test::Unit::TestCase class SummaryControllerAnotherTest < Test::Unit::TestCase -- James. http://blog.floehopper.org http://tumble.floehopper.org --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---