[rspec-users] mocking/stubbing newbie questions

Tim Lucas t.lucas at toolmantim.com
Tue Mar 27 10:01:51 EDT 2007


On 27/03/2007, at 11:55 PM, Scott Taylor wrote:

>       it "should find all terms associated with the user" do
>      User.should_receive(:find).with("1")
>    end
> end

...

> Spec::Mocks::MockExpectationError in 'GET /users/1/terms should find
> all terms associated with the user'
> User expected :find with ("1") once, but received it 0 times
> ./spec/controllers/terms_controller_spec.rb:43:

you forgot to actually call your do_get method:

it "should find all terms associated with the user" do
   User.should_receive(:find).with("1")
   do_get
end

-- tim




More information about the rspec-users mailing list