mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Pass matcher messages to failure results
This commit is contained in:
parent
8fb051d61e
commit
371fe680c2
2 changed files with 4 additions and 4 deletions
|
@ -10,13 +10,13 @@ module Spectator
|
||||||
|
|
||||||
def to(matcher : Matchers::Matcher)
|
def to(matcher : Matchers::Matcher)
|
||||||
unless matcher.match?(self)
|
unless matcher.match?(self)
|
||||||
raise ExpectationFailed.new
|
raise ExpectationFailed.new(matcher.message(self))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_not(matcher : Matchers::Matcher)
|
def to_not(matcher : Matchers::Matcher)
|
||||||
if matcher.match?(self)
|
if matcher.match?(self)
|
||||||
raise ExpectationFailed.new
|
raise ExpectationFailed.new(matcher.negated_message(self))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ module Spectator
|
||||||
puts "Failures:"
|
puts "Failures:"
|
||||||
puts
|
puts
|
||||||
failures.each_with_index do |failure, index|
|
failures.each_with_index do |failure, index|
|
||||||
display_failure(failure, index + 1)
|
display_failure(failure.as(FailedResult), index + 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -40,7 +40,7 @@ module Spectator
|
||||||
expected = "TODO"
|
expected = "TODO"
|
||||||
actual = "TODO"
|
actual = "TODO"
|
||||||
puts " #{number}) #{failure.example}"
|
puts " #{number}) #{failure.example}"
|
||||||
puts " Failure: <INSERT EXPECTATION HERE>"
|
puts " Failure: #{failure.error.message}"
|
||||||
puts
|
puts
|
||||||
puts " Expected: #{expected}"
|
puts " Expected: #{expected}"
|
||||||
puts " got: #{actual}"
|
puts " got: #{actual}"
|
||||||
|
|
Loading…
Reference in a new issue