[rspec-users] Mocking User.find( :all, :limit => 10 )
Daniel N
has.sox at gmail.com
Mon Jul 9 10:31:33 EDT 2007
Hi,
I'm trying to setup a mock for my controller test but I can't get it to
recognise the mock.
I use
it "should find all users" do
User.should_receive(:find).with( :all, :limit => 10
).and_return([@user])
do_get
end
and in the controller
@users = User.find(:all, :limit => 10 )
But this does not work. It gives me
User expected :find with (:all) once, but received it 0 times
If I remove the :limit from the controller
@users = User.find(:all)
I get
User expected :find with (:all, {:limit=>10}) once, but received it 0 times
How do I spec mocks with options passed to them?
Cheers
Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20070710/4d8df89c/attachment.html
More information about the rspec-users
mailing list