[rspec-users] Mocking models provided in Rails plugins
Dan Croak
dcroak at thoughtbot.com
Thu Oct 18 18:14:41 EDT 2007
Hey folks,
How do I mock a model that is given to me by a Rails plugin? I'm
trying to mock Session from the restful_authentication plugin but I
get a number of errors telling me RSpec doesn't recognize Session.
NameError in 'SessionsController handling GET /sessions/new should be
successful'
uninitialized constant Session
An example of my usage:
before do
@session = mock_model(Session)
Session.stub!(:new).and_return(@session)
end
Thanks!
Dan Croak
http://thoughtbot.com
organic brains. digital solutions.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20071018/14456927/attachment-0001.html
More information about the rspec-users
mailing list