[rspec-users] authentication, controller specs. I think I'm missing something simple ....

François Beausoleil francois.beausoleil at gmail.com
Tue Jun 12 15:36:32 EDT 2007


Hi,

2007/6/10, Rick Tessner <rick.tessner at gmail.com>:
> Nope, no difference there.  Joe's explanation of Enumerable#find vs. the
> find method that rails uses makes sense and certainly explains the
> error.
>
> Not sure yet how to work around this one ...

You have to mock #find on the Array instance itself.

things_proxy = [@thing]
things_proxy.stub!(:find).and_return(things_proxy)
@current_user = mock_model(User, :things => things_proxy)

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


More information about the rspec-users mailing list