I've got an instance double of a class and I want to stub two calls to the same method and return different values based on different arguments. This is an example of what I have.
allow(client_mock).to receive(:get_opportunity).with("1234567890").and_return(opportunity1) allow(client_mock).to receive(:get_opportunity).with("0987654321").and_return(opportunity2) I am getting the following error though #<InstanceDouble(Client) (anonymous)> received :get_opportunity with unexpected arguments expected: ("1234567890") got: ("0987654321") Please stub a default value first if message might be received with other args as well. I feel like I've done this before without problems. Could someone tell me what I'm doing wrong? -- You received this message because you are subscribed to the Google Groups "rspec" group. To unsubscribe from this group and stop receiving emails from it, send an email to rspec+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rspec/74a89ab9-4d86-4ddf-913d-42b928ecbac9n%40googlegroups.com.