From e14babc0146af1b6f3c0ee06c1eac609419d26b5 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Sun, 7 Oct 2018 13:45:36 -0600 Subject: [PATCH] ExpectationFailed exception takes a result --- src/spectator/expectation_failed.cr | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/spectator/expectation_failed.cr b/src/spectator/expectation_failed.cr index 5f15757..af7db98 100644 --- a/src/spectator/expectation_failed.cr +++ b/src/spectator/expectation_failed.cr @@ -1,4 +1,14 @@ module Spectator + # Exception that indicates a required expectation was not met in an example. class ExpectationFailed < Exception + # Outcome of the expectation. + # Additional information can be retrieved through this. + getter result : Expectations::Expectation::Result + + # Creates the exception. + # The exception string is generated from the expecation message. + def initialize(@result) + super(@result.actual_message) + end end end