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