diff --git a/src/spectator/expectations/expectation_partial.cr b/src/spectator/expectations/expectation_partial.cr index ed2e33c..8aa3709 100644 --- a/src/spectator/expectations/expectation_partial.cr +++ b/src/spectator/expectations/expectation_partial.cr @@ -37,6 +37,24 @@ module Spectator::Expectations to_not(matcher) end + # Asserts that some criteria defined by the matcher is eventually satisfied. + # The expectation is checked after the example finishes and all hooks have run. + def to_eventually(matcher) : Nil + Harness.current.defer { to(matcher) } + end + + # Asserts that some criteria defined by the matcher is never satisfied. + # The expectation is checked after the example finishes and all hooks have run. + def to_never(matcher) : Nil + Harness.current.defer { to_not(matcher) } + end + + # ditto + @[AlwaysInline] + def never_to(matcher) : Nil + to_never(matcher) + end + # Reports an expectation to the current harness. private def report(match_data : Matchers::MatchData) expectation = Expectation.new(match_data, @source)