mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Use harness' cleanup instead of defer
This commit is contained in:
parent
5c910e5a85
commit
e9d3f31ac3
1 changed files with 10 additions and 14 deletions
|
@ -164,13 +164,11 @@ module Spectator
|
|||
stubbable._spectator_define_stub(stub)
|
||||
|
||||
# Check if the stub was invoked after the test completes.
|
||||
Harness.current.defer do
|
||||
matcher = Matchers::ReceiveMatcher.new(stub)
|
||||
to(matcher, message)
|
||||
ensure
|
||||
Harness.current.defer { to(matcher, message) }
|
||||
|
||||
# Prevent leaking stubs between tests.
|
||||
stubbable._spectator_remove_stub(stub)
|
||||
end
|
||||
Harness.current.cleanup { stubbable._spectator_remove_stub(stub) }
|
||||
end
|
||||
|
||||
# Asserts that some criteria defined by the matcher is eventually satisfied.
|
||||
|
@ -202,13 +200,11 @@ module Spectator
|
|||
stubbable._spectator_define_stub(stub)
|
||||
|
||||
# Check if the stub was invoked after the test completes.
|
||||
Harness.current.defer do
|
||||
matcher = Matchers::ReceiveMatcher.new(stub)
|
||||
to_not(matcher, message)
|
||||
ensure
|
||||
Harness.current.defer { to_not(matcher, message) }
|
||||
|
||||
# Prevent leaking stubs between tests.
|
||||
stubbable._spectator_remove_stub(stub)
|
||||
end
|
||||
Harness.current.cleanup { stubbable._spectator_remove_stub(stub) }
|
||||
end
|
||||
|
||||
# :ditto:
|
||||
|
|
Loading…
Reference in a new issue