I have my method like
def my_method
MyClass.new.track(arg1, arg2)
if satisfies_some_condition
2.times { MyClass.new.track(arg3, arg4) }
end
end
In RSpec, I want to test receipt of #track
expect_any_instance_of(MyClass).to receive(:track).with(arg1, arg2)
expect_any_instance_of(MyClass).to receive(:track).with(arg3, arg4).twice
But I am getting this error
The message 'track' was received by
#<MyClass:70362069595680 >but has already been received by#<MyClass:0x007ffce788e460>
It seems here it's suggested that it should be resolved by upgrading to RSpec-mocks v3.6.0 But I am still getting the same error even after upgrading my RSpec-mocks gem to v3.6.0