Ruby on Rails Friday, July 30, 2010

Hey everybody,
I'm trying to test some code I wrote, and I wrote the following

def try_to_login(antonio)
antonio = users(:one)
#post :login, :user => { :screen_name => user.screen_name, :email =>
user.email, :password => user.password }
#post :login, :screen_name => antonio.screen_name, :email =>
antonio.email, :password => antonio.password
assert logged_in?
end

If I uncomment the first post line, I get "undefined local method or
variable 'user' for UserControllerTest, even though I have a model
called User.rb with a table called users in my database.
However, if I comment that line and uncomment the second post line,
everything works like a charm.. could anyone tell me why?

Thanks everybody in advance!
--
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@googlegroups.com.
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.

No comments:

Post a Comment