mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Convert bools to strings for output
This commit is contained in:
parent
3d86893f44
commit
5a1dea8f72
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} is not #{expected.label}", **snapshot)
|
||||
FailedMatchData.new("#{actual.label} is not #{expected.label}", **values(snapshot))
|
||||
end
|
||||
end
|
||||
|
||||
def negated_match(actual)
|
||||
snapshot = snapshot_values(actual.value)
|
||||
if match?(snapshot)
|
||||
FailedMatchData.new("#{actual.label} is #{expected.label}", **snapshot)
|
||||
FailedMatchData.new("#{actual.label} is #{expected.label}", **values(snapshot))
|
||||
else
|
||||
SuccessfulMatchData.new
|
||||
end
|
||||
|
@ -53,6 +53,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)
|
||||
# Test each predicate and immediately return false if one is false.
|
||||
{% for attribute in ExpectedType.keys %}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue