Handle union case for expected value

When using both forms of the HaveMatcher - expected can be a Char,
String, or Regex. Regex is invalid for String#includes?.
I believe this might be a generics issue that was fixed recently in
Crystal.
This commit is contained in:
Michael Miller 2019-08-09 00:32:45 -06:00
parent 353e5f6886
commit 8b718f0bd0

View file

@ -19,6 +19,7 @@ module Spectator::Matchers
private def match_string?(actual_value)
expected.value.all? do |item|
actual_value.includes?(item)
actual_value.includes?(item) if item.is_a?(Char | String)
end
end