[mocha-developer] Isn't it possible to stub / expect on :id ?

Francois Beausoleil francois.beausoleil at gmail.com
Wed Oct 25 20:30:31 EDT 2006


Hello James,

2006/10/25, James Mead <jamesmead44 at gmail.com>:
> To be honest we haven't run into this problem much at Reevoo. In your
> example above, what's wrong with doing this instead...?
>
> @payout = stub_everything()
> Payout.stubs(:find).with(141).returns(@payout)
>
> or...
>
> @payout = Payout.new { |payout| payout.id = 141 }
> Payout.stubs(:find).with(@payout.id).returns(@payout)

You're probably right.

> Can you explain any more about what you are trying to test?

I wanted to catch mishandles of the params[:id] parameter.  As you
said, I should just expect the actual value instead.

Thanks !
-- 
François Beausoleil
http://blog.teksol.info/
http://piston.rubyforge.org/


More information about the mocha-developer mailing list