Split error handler from failure method

This commit is contained in:
Michael Miller 2021-05-15 19:44:06 -06:00
parent a36982d6d6
commit e2f4051927
No known key found for this signature in database
GPG key ID: F9A0C5C65B162436
2 changed files with 11 additions and 3 deletions

View file

@ -63,11 +63,19 @@ module Spectator::Formatting
# Invoked after an example fails.
# This is called right after `#example_finished`.
# Errors are considered failures and will cause this method to be called.
# The *notification* will be an `ExampleNotification` type of object.
#
# NOTE: Errors are normally considered failures,
# however `#example_error` is called instead if one occurs in an exmaple.
def example_failed(_notification)
end
# Invoked after an example fails from an unexpected error.
# This is called right after `#example_finished`.
# The *notification* will be an `ExampleNotification` type of object.
def example_error(_notification)
end
# Called whenever the example or framework produces a message.
# This is typically used for logging.
def message(_notification)

View file

@ -58,9 +58,9 @@ module Spectator
@formatter.example_failed(@notification)
end
# Invokes the example failed method.
# Invokes the example error method.
def error
@formatter.example_failed(@notification)
@formatter.example_error(@notification)
end
# Invokes the example pending method.