Thanks for the replys. 

It end up being user error. I was passing the wrong argument when 
initializing my test subject.

- Aaric

On Thursday, February 11, 2021 at 12:54:02 PM UTC-6 pirj...@gmail.com wrote:

> Aaric,
>
> I might be missing something, but the following:
>
> ```
> RSpec.describe 'A' do
> it do
> opportunity1 = 1
> opportunity2 = 2
>
> client_mock = double
>
> allow(client_mock).to
> receive(:get_opportunity).with("1234567890").and_return(opportunity1)
> allow(client_mock).to
> receive(:get_opportunity).with("0987654321").and_return(opportunity2)
>
> expect(client_mock.get_opportunity("1234567890")).to eq 1
> expect(client_mock.get_opportunity("0987654321")).to eq 2
> end
> end
> ```
> passes just fine.
> Even if you swap the call order.
> Even if you call `get_opportunity` several times with the same argument.
>
> How do you define `client_mock` exactly?
>
> - Phil
>

-- 
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/77e913e9-aad9-47c1-bac5-a98da111ea00n%40googlegroups.com.

Reply via email to