mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Run after-all hooks correctly
This commit is contained in:
parent
95fa9b39b2
commit
0e3727b504
2 changed files with 8 additions and 4 deletions
|
@ -37,7 +37,7 @@ module Spectator
|
|||
result = run_example(example).as(Result)
|
||||
results << result
|
||||
if @config.fail_fast? && result.is_a?(FailedResult)
|
||||
# TODO: example.group.run_after_all_hooks(ignore_unfinished: true)
|
||||
example.group.context.run_after_all_hooks(example.group, ignore_unfinished: true)
|
||||
break
|
||||
end
|
||||
end
|
||||
|
|
|
@ -31,14 +31,18 @@ module Spectator
|
|||
|
||||
def run_after_hooks(example : Example)
|
||||
run_after_each_hooks(example)
|
||||
run_after_all_hooks
|
||||
run_after_all_hooks(example.group)
|
||||
end
|
||||
|
||||
protected def run_after_all_hooks
|
||||
protected def run_after_all_hooks(group : ExampleGroup, *, ignore_unfinished = false)
|
||||
return if @after_all_hooks_run
|
||||
return unless ignore_unfinished || group.finished?
|
||||
|
||||
@hooks.run_after_all
|
||||
@parent.try &.run_after_all_hooks
|
||||
@parent.try do |parent_context|
|
||||
parent_group = group.as(NestedExampleGroup).parent
|
||||
parent_context.run_after_all_hooks(parent_group, ignore_unfinished: ignore_unfinished)
|
||||
end
|
||||
ensure
|
||||
@after_all_hooks_run = true
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue