diff --git a/src/spectator/expectation.cr b/src/spectator/expectation.cr index 4bec79d..1f72bb0 100644 --- a/src/spectator/expectation.cr +++ b/src/spectator/expectation.cr @@ -10,13 +10,13 @@ module Spectator def to(matcher : Matchers::Matcher) unless matcher.match?(self) - raise ExpectationFailed.new + raise ExpectationFailed.new(matcher.message(self)) end end def to_not(matcher : Matchers::Matcher) if matcher.match?(self) - raise ExpectationFailed.new + raise ExpectationFailed.new(matcher.negated_message(self)) end end diff --git a/src/spectator/formatters/default_formatter.cr b/src/spectator/formatters/default_formatter.cr index 370d569..7fbacdd 100644 --- a/src/spectator/formatters/default_formatter.cr +++ b/src/spectator/formatters/default_formatter.cr @@ -31,7 +31,7 @@ module Spectator puts "Failures:" puts failures.each_with_index do |failure, index| - display_failure(failure, index + 1) + display_failure(failure.as(FailedResult), index + 1) end end end @@ -40,7 +40,7 @@ module Spectator expected = "TODO" actual = "TODO" puts " #{number}) #{failure.example}" - puts " Failure: " + puts " Failure: #{failure.error.message}" puts puts " Expected: #{expected}" puts " got: #{actual}"