我有一個存根對特定的類方法是有效的我的大多數測試。我在模塊之前設置了模擬模式,以便對測試進行干預。我想刪除一個測試無效的存根。我如何使用RSpec來做到這一點?刪除expect_any_instance_of RSpec
代碼
before :all do
expect_any_instance_of(Foo).to receive(:callback)
end
it 'does a callback on this test' do
Foo.new
end
it 'does it in this too!' do
Foo.new.other
end
it 'doesnt do it in this one' do
# how do i remove the stub???
end