allow_any_instance_of().to_receive cannot yield multiple times
Created by: nkall
When using allow_any_instance_of() instead of allow(), chaining multiple and_yield()s throws an error. So either of these work fine:
allow(Klass).to_receive(:method).and_yield(1).and_yield(2)
allow_any_instance_of(Klass).to_receive(:method).and_yield(1)
But attempting the following:
allow_any_instance_of(Klass).to_receive(:method).and_yield(1).and_yield(2)
Results in a NoMethodError: Undefined method and_yield
. Using rspec-mocks 3.3.2.