Methods which are defined during runtime might not be found by rspec’s allow(..).to receive
. To solve this, disable the verification using without_partial_double_verification
:
without_partial_double_verification do
allow_any_instance_of(Cat).to receive(:play).and_raise(StandardError)
end