Ruby on Rails
Wednesday, June 29, 2011
...That's odd. I just read The RSpec Book, and it explains how double isn't sufficient when you're testing something related to form_for. The book, in its example, says to use mock_model("Message").as_new_record...
and anyway in my case neither method is working. If I use mock_model, I get
Failure/Error: assign(:user_session, mock_model("UserSession").as_new_record)
ArgumentError:
The mock_model method can only accept as its first argument:
* A String representing a Class that does not exist
* A String representing a Class that extends ActiveModel::Naming
* A Class that extends ActiveModel::Naming
It received UserSession
...and if I use double, I get the error the book says I'd get: "undefined method `model_name' for RSpec::Mocks::Mock:Class"
:/ so I wonder what the best way to test form_for is now with rspec... btw I'm using Capybara.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/SiaXC-JCDPgJ.
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.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment