2018-10-20 02:58:14 +00:00
|
|
|
require "./example_failed"
|
|
|
|
|
2018-09-15 17:05:11 +00:00
|
|
|
module Spectator
|
2018-10-07 19:45:36 +00:00
|
|
|
# Exception that indicates a required expectation was not met in an example.
|
2018-10-20 02:58:14 +00:00
|
|
|
class ExpectationFailed < ExampleFailed
|
2018-11-13 22:59:51 +00:00
|
|
|
# Expectation that failed.
|
|
|
|
getter expectation : Expectations::Expectation
|
2018-10-07 19:45:36 +00:00
|
|
|
|
|
|
|
# Creates the exception.
|
|
|
|
# The exception string is generated from the expecation message.
|
2018-11-13 22:59:51 +00:00
|
|
|
def initialize(@expectation)
|
|
|
|
super(@expectation.actual_message)
|
2018-10-07 19:45:36 +00:00
|
|
|
end
|
2018-09-15 17:05:11 +00:00
|
|
|
end
|
|
|
|
end
|