[rspec-users] Mocking User.find( :all, :limit => 10 )
Daniel N
has.sox at gmail.com
Mon Jul 9 11:00:31 EDT 2007
My Bad... Please ignore
On 7/10/07, Daniel N <has.sox at gmail.com> wrote:
>
> 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/cb13ee46/attachment.html
More information about the rspec-users
mailing list