I think that in this case you would need to do what I think of as the method stubbing equivalent of as_null_object
:
describe Foo
describe 'testing .bar multiple times' do
before do
allow(Foo).to receive(:bar) # stub out message
end
it "can determine how many times it has been called with 'true'" do
expect(Foo).to receive(:bar).at_least(:once).with("true")
expect(Foo).to receive(:bar).at_most(:once).with("true")
Foo.bar("false")
Foo.bar("false")
Foo.bar("true")
Foo.bar("false")
end
end
end