Fix issue when using nil with `be` matcher

This commit is contained in:
Michael Miller 2020-04-01 22:17:19 -06:00
parent e585c36207
commit a655abb7ac
1 changed files with 1 additions and 1 deletions

View File

@ -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.