In RSpec, is there a method equivalent to “unstub” but for “should_receive”?

You can overwrite some previous mocking by:

expect(RestClient).to receive(:delete).and_call_original

Or if it is wasn’t any kind of expectation, just a simple stub:

allow(RestClient).to receive(:delete).and_call_original

Remember there exists also expect_any_instance_of and allow_any_instance_of.

Leave a Comment