[rspec-users] Mocking models provided in Rails plugins

Brandon Keepers bkeepers at gmail.com
Thu Oct 18 19:38:49 EDT 2007


Dan,

On Oct 18, 2007, at 6:14 PM, Dan Croak wrote:

> 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

Your problem is that the class isn't just Session, it's  
CGI::Session::ActiveRecordStore::Session

Brandon




More information about the rspec-users mailing list