From a655abb7acfb32baf8bebc4df5b7f4ca21d72007 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Wed, 1 Apr 2020 22:17:19 -0600 Subject: [PATCH] Fix issue when using nil with `be` matcher --- src/spectator/matchers/reference_matcher.cr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/spectator/matchers/reference_matcher.cr b/src/spectator/matchers/reference_matcher.cr index e7907ae..74ce6e7 100644 --- a/src/spectator/matchers/reference_matcher.cr +++ b/src/spectator/matchers/reference_matcher.cr @@ -14,7 +14,7 @@ module Spectator::Matchers # Checks whether the matcher is satisifed with the expression given to it. private def match?(actual : TestExpression(T)) : Bool forall T value = expected.value - if value.responds_to?(:same?) + if value && value.responds_to?(:same?) value.same?(actual.value) else # Value type (struct) comparison.