mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Fix after_all hooks running too soon
This commit is contained in:
parent
77753ab974
commit
9f778c5cb9
3 changed files with 7 additions and 3 deletions
|
@ -50,10 +50,12 @@ module Spectator
|
|||
|
||||
def run_after_all_hooks
|
||||
unless @after_all_hooks_run
|
||||
@after_all_hooks.each do |hook|
|
||||
hook.call
|
||||
if all_examples.all?(&.finished?)
|
||||
@after_all_hooks.each do |hook|
|
||||
hook.call
|
||||
end
|
||||
@after_all_hooks_run = true
|
||||
end
|
||||
@after_all_hooks_run = true
|
||||
end
|
||||
if (parent = @parent)
|
||||
parent.run_after_all_hooks
|
||||
|
|
|
@ -161,6 +161,7 @@ module Spectator
|
|||
begin
|
||||
Example%example.new.%run({% for v, i in var_names %}%var{i}{% if i < var_names.size - 1 %}, {% end %}{% end %})
|
||||
ensure
|
||||
@finished = true
|
||||
context.run_after_each_hooks
|
||||
context.run_after_all_hooks
|
||||
end
|
||||
|
|
|
@ -3,6 +3,7 @@ require "./source"
|
|||
module Spectator
|
||||
abstract class Example
|
||||
getter context : Context
|
||||
getter? finished = false
|
||||
|
||||
def initialize(@context)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue