diff --git a/shard.yml b/shard.yml index 830c2c0..cc50ced 100644 --- a/shard.yml +++ b/shard.yml @@ -13,4 +13,4 @@ license: MIT development_dependencies: ameba: github: crystal-ameba/ameba - version: ~> 0.13.1 + version: ~> 0.14.3 diff --git a/src/spectator/matchers/array_matcher.cr b/src/spectator/matchers/array_matcher.cr index 77dc14c..bb355a3 100644 --- a/src/spectator/matchers/array_matcher.cr +++ b/src/spectator/matchers/array_matcher.cr @@ -110,9 +110,9 @@ module Spectator::Matchers end end.reject do |(_, count)| count <= 0 - end.map do |(element, count)| + end.flat_map do |(element, count)| Array.new(count, element) - end.flatten + end end private def unexpected(value, label) diff --git a/src/spectator/matchers/respond_matcher.cr b/src/spectator/matchers/respond_matcher.cr index 6d36f80..1f73f57 100644 --- a/src/spectator/matchers/respond_matcher.cr +++ b/src/spectator/matchers/respond_matcher.cr @@ -27,7 +27,8 @@ module Spectator::Matchers # A successful match with `#match` should normally fail for this method, and vice-versa. def negated_match(actual : Expression(T)) : MatchData forall T snapshot = snapshot_values(actual.value) - if snapshot.values.any? + # Intentionally check truthiness of each value. + if snapshot.values.any? # ameba:disable Performance/AnyInsteadOfEmpty FailedMatchData.new(description, "#{actual.label} responds to #{label}", values(snapshot).to_a) else SuccessfulMatchData.new(description)