mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Fix flipped append/prepend of "after" hooks
This commit is contained in:
parent
b9f0a31a4a
commit
841efc236d
3 changed files with 7 additions and 7 deletions
|
@ -26,7 +26,7 @@ module Spectator
|
|||
before_all_hooks.each &.call_once
|
||||
end
|
||||
|
||||
define_hook after_all : ExampleGroupHook do
|
||||
define_hook after_all : ExampleGroupHook, :prepend do
|
||||
Log.trace { "Processing after_all hooks for #{self}" }
|
||||
|
||||
after_all_hooks.each &.call_once if finished?
|
||||
|
@ -42,7 +42,7 @@ module Spectator
|
|||
before_each_hooks.each &.call(example)
|
||||
end
|
||||
|
||||
define_hook after_each : ExampleHook do |example|
|
||||
define_hook after_each : ExampleHook, :prepend do |example|
|
||||
Log.trace { "Processing after_each hooks for #{self}" }
|
||||
|
||||
after_each_hooks.each &.call(example)
|
||||
|
|
|
@ -50,8 +50,8 @@ module Spectator
|
|||
private def apply_hooks(group)
|
||||
before_all_hooks.each { |hook| group.before_all(hook) }
|
||||
before_each_hooks.each { |hook| group.before_each(hook) }
|
||||
after_all_hooks.each { |hook| group.after_all(hook) }
|
||||
after_each_hooks.each { |hook| group.after_each(hook) }
|
||||
after_all_hooks.reverse_each { |hook| group.after_all(hook) }
|
||||
after_each_hooks.reverse_each { |hook| group.after_each(hook) }
|
||||
around_each_hooks.each { |hook| group.around_each(hook) }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -236,9 +236,9 @@ module Spectator
|
|||
# Copy all hooks from config to top-level group.
|
||||
private def apply_config_hooks(group)
|
||||
config.before_suite_hooks.reverse_each { |hook| group.prepend_before_all(hook) }
|
||||
config.after_suite_hooks.each { |hook| group.after_all(hook) }
|
||||
config.after_suite_hooks.each { |hook| group.append_after_all(hook) }
|
||||
config.before_each_hooks.reverse_each { |hook| group.prepend_before_each(hook) }
|
||||
config.after_each_hooks.each { |hook| group.after_each(hook) }
|
||||
config.after_each_hooks.each { |hook| group.append_after_each(hook) }
|
||||
config.around_each_hooks.reverse_each { |hook| group.prepend_around_each(hook) }
|
||||
|
||||
# `before_all` and `after_all` hooks from config are slightly different.
|
||||
|
@ -247,7 +247,7 @@ module Spectator
|
|||
next unless node.is_a?(Hooks)
|
||||
|
||||
config.before_all_hooks.reverse_each { |hook| node.prepend_before_all(hook.dup) }
|
||||
config.after_all_hooks.each { |hook| node.after_all(hook.dup) }
|
||||
config.after_all_hooks.each { |hook| node.append_after_all(hook.dup) }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue