mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Stringify respond_to bools
This commit is contained in:
parent
39f253952d
commit
37c8dd0865
1 changed files with 12 additions and 2 deletions
|
@ -20,14 +20,14 @@ module Spectator::Matchers
|
|||
if match?(snapshot)
|
||||
SuccessfulMatchData.new
|
||||
else
|
||||
FailedMatchData.new("#{actual.label} does not respond to #{label}", **snapshot)
|
||||
FailedMatchData.new("#{actual.label} does not respond to #{label}", **values(snapshot))
|
||||
end
|
||||
end
|
||||
|
||||
def negated_match(actual : TestExpression(T)) : MatchData forall T
|
||||
snapshot = snapshot_values(actual.value)
|
||||
if match?(snapshot)
|
||||
FailedMatchData.new("#{actual.label} responds to #{label}", **snapshot)
|
||||
FailedMatchData.new("#{actual.label} responds to #{label}", **values(snapshot))
|
||||
else
|
||||
SuccessfulMatchData.new
|
||||
end
|
||||
|
@ -45,6 +45,16 @@ module Spectator::Matchers
|
|||
{% end %}
|
||||
end
|
||||
|
||||
private def values(snapshot)
|
||||
{% begin %}
|
||||
{
|
||||
{% for attribute in ExpectedType.keys %}
|
||||
{{attribute}}: snapshot[{{attribute.symbolize}}].inspect,
|
||||
{% end %}
|
||||
}
|
||||
{% end %}
|
||||
end
|
||||
|
||||
private def match?(snapshot)
|
||||
# The snapshot did the hard work.
|
||||
# Here just check if all values are true.
|
||||
|
|
Loading…
Reference in a new issue