Hi guys,
Need some help.
I am using Rails 2.0 and while writing functional test, I encountered
the following problem
class UserControllerTest < ActionController::TestCase
fixtures :users
...
def do_something
attempt_login(users(:valid_user)) # assuming valid_user is a
proper line in
...
end
def attempt_login(user)
post :login, :user => { :login => user.login, :password =>
user.password }
end
Running the test:
...
1) Error:
do_something(UserControllerTest):
NoMethodError: You have a nil object when you didn''t expect it!
The error occurred while evaluating nil.login
test/functional/user_controller_test.rb:41:in `attempt_login''
test/functional/user_controller_test.rb:32:in `do_something''
/usr/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/
testing/default.rb:7:in `run''
* I tried putting fixtures :users within setup, still the same
problem. This works if I derive Test::Unit::TestCase instead of the
new rails 2.0 default class
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---