Resolve issue trying to splat union of named tuples

This commit is contained in:
Michael Miller 2019-11-16 09:02:57 -07:00
parent 85531fecf9
commit ca85acefaf
2 changed files with 6 additions and 2 deletions

View file

@ -14,6 +14,10 @@ module Spectator::Matchers
# Additional information from the match that can be used to debug the problem.
getter values : Array(Tuple(Symbol, String))
# Creates the match data.
def initialize(@failure_message, @values)
end
# Creates the match data.
def initialize(@failure_message, **values)
@values = values.to_a

View file

@ -27,7 +27,7 @@ module Spectator::Matchers
if match?(actual)
SuccessfulMatchData.new
else
FailedMatchData.new(failure_message(actual), **values(actual))
FailedMatchData.new(failure_message(actual), values(actual).to_a)
end
end
@ -42,7 +42,7 @@ module Spectator::Matchers
if does_not_match?(actual)
SuccessfulMatchData.new
else
FailedMatchData.new(failure_message_when_negated(actual), **negated_values(actual))
FailedMatchData.new(failure_message_when_negated(actual), negated_values(actual).to_a)
end
end