[rspec-users] Stub activerecord find given instance?

David Chelimsky dchelimsky at gmail.com
Mon Dec 14 07:39:20 EST 2009


On Sat, Dec 12, 2009 at 1:35 PM, Saverio Miroddi <lists at ruby-forum.com> wrote:
> Tom Stuart wrote:
>> On 10 Nov 2009, at 14:08, Saverio Miroddi wrote:
>>> Is there a clean/simple way of stubbing the activerecord find() for a
>>> single instance?
>>
>> MyModel.stub(:find).with(42).and_return(myModel)
>
> Didn't work as expected - I'll do a bit of research and post again.

What is expected? What are you trying to accomplish?


More information about the rspec-users mailing list