Update Ameba and address issues

This commit is contained in:
Michael Miller 2021-05-15 19:51:44 -06:00
parent aa03e3527d
commit 5da21f8ede
No known key found for this signature in database
GPG Key ID: F9A0C5C65B162436
3 changed files with 5 additions and 4 deletions

View File

@ -13,4 +13,4 @@ license: MIT
development_dependencies:
ameba:
github: crystal-ameba/ameba
version: ~> 0.13.1
version: ~> 0.14.3

View File

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

View File

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