mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Run deferred blocks
This commit is contained in:
parent
2128184659
commit
6b3885af30
1 changed files with 12 additions and 0 deletions
|
@ -20,6 +20,7 @@ module Spectator
|
|||
context.run_before_hooks(self)
|
||||
run_example(result)
|
||||
context.run_after_hooks(self)
|
||||
run_deferred(result)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -40,6 +41,17 @@ module Spectator
|
|||
end
|
||||
end
|
||||
|
||||
# Runs the deferred blocks of code and captures the result.
|
||||
private def run_deferred(result)
|
||||
result.elapsed += Time.measure do
|
||||
begin
|
||||
Harness.current.run_deferred
|
||||
rescue ex # Catch all errors and handle them later.
|
||||
result.error = ex
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Creates a result instance from captured result information.
|
||||
private def translate_result(result, expectations)
|
||||
case (error = result.error)
|
||||
|
|
Loading…
Reference in a new issue