[rspec-users] Stub activerecord find given instance?

Saverio Miroddi lists at ruby-forum.com
Tue Nov 10 09:08:35 EST 2009

Is there a clean/simple way of stubbing the activerecord find() for a
single instance?

As usual pattern, I see something like

myModel = MyModel.new(...)
MyModel.stub( :find ).and_return( myModel )

which can give problems in case we want to find other instances.

Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list