Read more

RSpec: Expecting multiple calls of the same method

Henning Koch
March 20, 2018Software engineer at makandra GmbH

If the argument list is the same every time:

expect(object).to receive(:foo).with('argument').and_return('response 1', 'response 2')
Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show archive.org snapshot

If the argument list differs between invocations:

expect(object).to receive(:foo).with('argument 1').ordered.and_return('response 1')
expect(object).to receive(:foo).with('argument 2').ordered.and_return('response 2')
Posted by Henning Koch to makandra dev (2018-03-20 17:52)