From edf8ae36df9bb4c1922936c7bd7170a9fdd9f332 Mon Sep 17 00:00:00 2001 From: Michael Miller <icy.arctic.fox@gmail.com> Date: Wed, 23 Dec 2020 14:19:40 -0700 Subject: [PATCH] Fix negated contain case --- src/spectator/matchers/contain_matcher.cr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/spectator/matchers/contain_matcher.cr b/src/spectator/matchers/contain_matcher.cr index 41e794e..afc73fd 100644 --- a/src/spectator/matchers/contain_matcher.cr +++ b/src/spectator/matchers/contain_matcher.cr @@ -46,11 +46,11 @@ module Spectator::Matchers actual_value = actual.value return unexpected(actual_value, actual.label) unless actual_value.responds_to?(:includes?) - missing = expected.value.reject do |item| + satisfied = expected.value.any? do |item| actual_value.includes?(item) end - if missing.empty? + if satisfied # Contents are present. FailedMatchData.new(description, "#{actual.label} contains #{expected.label}", expected: "Not #{expected.value.inspect}",