mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Fix negation case for respond_to matcher
This commit is contained in:
parent
ed48b80d58
commit
a2508d5f6b
1 changed files with 2 additions and 9 deletions
|
@ -16,7 +16,7 @@ module Spectator::Matchers
|
|||
# Actually performs the test against the expression.
|
||||
def match(actual : TestExpression(T)) : MatchData forall T
|
||||
snapshot = snapshot_values(actual.value)
|
||||
if match?(snapshot)
|
||||
if snapshot.values.all?
|
||||
SuccessfulMatchData.new(description)
|
||||
else
|
||||
FailedMatchData.new(description, "#{actual.label} does not respond to #{label}", **values(snapshot))
|
||||
|
@ -27,7 +27,7 @@ module Spectator::Matchers
|
|||
# A successful match with `#match` should normally fail for this method, and vice-versa.
|
||||
def negated_match(actual : TestExpression(T)) : MatchData forall T
|
||||
snapshot = snapshot_values(actual.value)
|
||||
if match?(snapshot)
|
||||
if snapshot.values.any?
|
||||
FailedMatchData.new(description, "#{actual.label} responds to #{label}", **values(snapshot))
|
||||
else
|
||||
SuccessfulMatchData.new(description)
|
||||
|
@ -46,13 +46,6 @@ module Spectator::Matchers
|
|||
{% end %}
|
||||
end
|
||||
|
||||
# Checks if all results from the snapshot are satisified.
|
||||
private def match?(snapshot)
|
||||
# The snapshot did the hard work.
|
||||
# Here just check if all values are true.
|
||||
snapshot.values.all?
|
||||
end
|
||||
|
||||
# Produces the tuple for the failed match data from a snapshot of the results.
|
||||
private def values(snapshot)
|
||||
{% begin %}
|
||||
|
|
Loading…
Reference in a new issue