Guest User

Untitled

a guest
Jul 19th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. # this would be in a helper somewhere
  2. def stub_find(entity)
  3. result = mock_model(entity)
  4. entity.stub(:find).with(result.id).and_return(result)
  5. result
  6. end
  7.  
  8. let(:params) do
  9. {:these => 'params'}
  10. end
  11.  
  12. it "updates the requested book" do
  13. mock_book = stub_find(Book)
  14. mock_book.should_receive(:update_attributes).with(params)
  15. put :update, :id => book.id, :book => params
  16. end
Add Comment
Please, Sign In to add comment