tl;dr You can use ordered to ensure that messages are received in a specific order.
You can use ordered to ensure that messages are received in a specific order.
ordered
Copyexpect(ClassA).to receive(:call_first).ordered expect(ClassB).to receive(:call_second).ordered expect(ClassB).to receive(:call_third).ordered
expect(ClassA).to receive(:call_first).ordered expect(ClassB).to receive(:call_second).ordered expect(ClassB).to receive(:call_third).ordered
#ordered supports further chaining Example
Example