Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # this would be in a helper somewhere
- def stub_find(entity)
- result = mock_model(entity)
- entity.stub(:find).with(result.id).and_return(result)
- result
- end
- let(:params) do
- {:these => 'params'}
- end
- it "updates the requested book" do
- mock_book = stub_find(Book)
- mock_book.should_receive(:update_attributes).with(params)
- put :update, :id => book.id, :book => params
- end
Add Comment
Please, Sign In to add comment