Capture exception from failed specs

This commit is contained in:
Michael Miller 2018-08-30 21:10:36 -06:00
parent 3aa6ab7a10
commit 65b16f9031
2 changed files with 7 additions and 2 deletions

View file

@ -2,8 +2,13 @@ require "./example_result"
module Spectator
class FailedExampleResult < ExampleResult
getter error : Exception
def passed? : Bool
false
end
def initialize(@example, @error)
end
end
end

View file

@ -19,8 +19,8 @@ module Spectator
private def run_example(example)
example.run
SuccessfulExampleResult.new(example)
rescue
FailedExampleResult.new(example)
rescue ex : Exception
FailedExampleResult.new(example, ex)
end
end
end