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,11 +50,13 @@ module Spectator
|
||||||
|
|
||||||
def run_after_all_hooks
|
def run_after_all_hooks
|
||||||
unless @after_all_hooks_run
|
unless @after_all_hooks_run
|
||||||
|
if all_examples.all?(&.finished?)
|
||||||
@after_all_hooks.each do |hook|
|
@after_all_hooks.each do |hook|
|
||||||
hook.call
|
hook.call
|
||||||
end
|
end
|
||||||
@after_all_hooks_run = true
|
@after_all_hooks_run = true
|
||||||
end
|
end
|
||||||
|
end
|
||||||
if (parent = @parent)
|
if (parent = @parent)
|
||||||
parent.run_after_all_hooks
|
parent.run_after_all_hooks
|
||||||
end
|
end
|
||||||
|
|
|
@ -161,6 +161,7 @@ module Spectator
|
||||||
begin
|
begin
|
||||||
Example%example.new.%run({% for v, i in var_names %}%var{i}{% if i < var_names.size - 1 %}, {% end %}{% end %})
|
Example%example.new.%run({% for v, i in var_names %}%var{i}{% if i < var_names.size - 1 %}, {% end %}{% end %})
|
||||||
ensure
|
ensure
|
||||||
|
@finished = true
|
||||||
context.run_after_each_hooks
|
context.run_after_each_hooks
|
||||||
context.run_after_all_hooks
|
context.run_after_all_hooks
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,6 +3,7 @@ require "./source"
|
||||||
module Spectator
|
module Spectator
|
||||||
abstract class Example
|
abstract class Example
|
||||||
getter context : Context
|
getter context : Context
|
||||||
|
getter? finished = false
|
||||||
|
|
||||||
def initialize(@context)
|
def initialize(@context)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue