From bd0396c001aed4628f0b4e6b1e9b07e3b5823eaf Mon Sep 17 00:00:00 2001
From: Michael Miller <icy.arctic.fox@gmail.com>
Date: Thu, 14 Nov 2019 18:19:37 -0700
Subject: [PATCH] Add to_eventually and to_never operations

This defines what they should look like.
---
 .../expectations/expectation_partial.cr        | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

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)