I have this in my test
Project.should_receive(:find).with(@project).and_return(@project)
but when object receive that method call two times, I have to do
Project.should_receive(:find).with(@project).and_return(@project)
Project.should_receive(:find).with(@project).and_return(@project)
Is there any way how to say something like
Project.should_receive(:find).with(@project).and_return(@project).times(2)
Best Answer
This is outdated. Please check Uri's answer below
for 2 times:
for exactly n times:
for at least n times:
more details at https://www.relishapp.com/rspec/rspec-mocks/v/2-13/docs/message-expectations/receive-counts under Receive Counts
Hope it helps =)