Fix negated contain case

This commit is contained in:
Michael Miller 2020-12-23 14:19:40 -07:00
parent a2ef0fa46a
commit edf8ae36df
No known key found for this signature in database
GPG key ID: FB9F12F7C646A4AD

View file

@ -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}",