From 84476b0357776ba347d9a4cc5600cf608e3751f7 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Thu, 23 Apr 2020 22:43:37 -0600 Subject: [PATCH] Treat to(mock) and to_eventually(mock) as the same Fixes https://gitlab.com/arctic-fox/spectator/-/issues/48 --- .../expectations/expectation_partial.cr | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/spectator/expectations/expectation_partial.cr b/src/spectator/expectations/expectation_partial.cr index b7a602d..6a38301 100644 --- a/src/spectator/expectations/expectation_partial.cr +++ b/src/spectator/expectations/expectation_partial.cr @@ -64,12 +64,28 @@ module Spectator::Expectations Harness.current.defer { to(matcher) } end + def to_eventually(stub : Mocks::MethodStub) : Nil + to(stub) + end + + def to_eventually(stubs : Enumerable(Mocks::MethodStub)) : Nil + to(stub) + 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 + def to_never(stub : Mocks::MethodStub) : Nil + to_not(stub) + end + + def to_never(stub : Enumerable(Mocks::MethodStub)) : Nil + to_not(stub) + end + # ditto @[AlwaysInline] def never_to(matcher) : Nil