Raise error instead of failing test

If an error occurs in any hooks, raise it instead of failing the test.
This commit is contained in:
Michael Miller 2018-12-07 22:43:26 -07:00
parent 22f32eb03e
commit aeebbaa5b6

View file

@ -29,9 +29,8 @@ module Spectator
private def run_after_hooks(result) private def run_after_hooks(result)
group.run_after_hooks group.run_after_hooks
rescue ex rescue ex
# Store the error from the hooks # If an error occurs in the after hooks, elevate it to abort testing.
# if the example didn't encounter an error. raise Exception.new("Error encountered while running after hooks", ex)
result.error = ex unless result.error
end end
# Runs all hooks and the example code. # Runs all hooks and the example code.