From a65aedbfb741ee58f3728f051972e3253b73456c Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Thu, 30 Aug 2018 14:15:07 -0600 Subject: [PATCH] Implement #to_not --- src/spectator/expectation.cr | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/spectator/expectation.cr b/src/spectator/expectation.cr index 6a152ea..9c9b4b4 100644 --- a/src/spectator/expectation.cr +++ b/src/spectator/expectation.cr @@ -16,5 +16,16 @@ module Spectator raise ExpectationFailedError.new end end + + def to_not(matcher : Matchers::Matcher) + if matcher.match?(self) + raise ExpectationFailedError.new + end + end + + @[AlwaysInline] + def not_to(matcher : Matchers::Matcher) + to_not(matcher) + end end end