Clear stubs defined with expect().to receive() syntax after test finishes

This commit is contained in:
Michael Miller 2022-10-09 13:57:28 -06:00
parent 25b9931002
commit 5c910e5a85
No known key found for this signature in database
GPG key ID: 32B47AE8F388A1FF
3 changed files with 25 additions and 6 deletions

View file

@ -146,9 +146,9 @@ Spectator.describe "Mocks Docs" do
inst.something
end
it "leaks stubs to other examples" do
it "reverts to default stub for other examples" do
inst = mock(MyStruct)
expect(inst.something).to eq(7) # Previous stub was leaked.
expect(inst.something).to eq(5) # Default stub used instead of original behavior.
end
end
end