mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Handle errored and failing specs separately
An errored example is one that throws an exception that is not from an expectation failing.
This commit is contained in:
parent
65b16f9031
commit
c100651680
2 changed files with 18 additions and 2 deletions
14
src/spectator/errored_example_result.cr
Normal file
14
src/spectator/errored_example_result.cr
Normal file
|
@ -0,0 +1,14 @@
|
|||
require "./failed_example_result"
|
||||
|
||||
module Spectator
|
||||
class ErroredExampleResult < FailedExampleResult
|
||||
getter error : Exception
|
||||
|
||||
def errored? : Bool
|
||||
true
|
||||
end
|
||||
|
||||
def initialize(@example, @error)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -19,8 +19,10 @@ module Spectator
|
|||
private def run_example(example)
|
||||
example.run
|
||||
SuccessfulExampleResult.new(example)
|
||||
rescue ex : Exception
|
||||
FailedExampleResult.new(example, ex)
|
||||
rescue failure : ExpectationFailedError
|
||||
FailedExampleResult.new(example, failure)
|
||||
rescue ex
|
||||
ErroredExampleResult.new(example, ex)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue