mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Reduce nesting of conditionals
This commit is contained in:
parent
101489ea19
commit
f3feabb6e0
1 changed files with 7 additions and 10 deletions
|
@ -127,10 +127,9 @@ module Spectator
|
||||||
# The hooks will be run only once.
|
# The hooks will be run only once.
|
||||||
# Subsequent calls to this method will do nothing.
|
# Subsequent calls to this method will do nothing.
|
||||||
def run_before_all_hooks : Nil
|
def run_before_all_hooks : Nil
|
||||||
unless @before_all_hooks_run
|
return if @before_all_hooks_run
|
||||||
@hooks.run_before_all
|
@hooks.run_before_all
|
||||||
@before_all_hooks_run = true
|
@before_all_hooks_run = true
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Runs all of the `before_each` hooks.
|
# Runs all of the `before_each` hooks.
|
||||||
|
@ -145,12 +144,10 @@ module Spectator
|
||||||
# and only after all examples in the group have finished.
|
# and only after all examples in the group have finished.
|
||||||
# Subsequent calls after the hooks have been run will do nothing.
|
# Subsequent calls after the hooks have been run will do nothing.
|
||||||
def run_after_all_hooks : Nil
|
def run_after_all_hooks : Nil
|
||||||
unless @after_all_hooks_run
|
return if @after_all_hooks_run
|
||||||
if finished?
|
return unless finished?
|
||||||
@hooks.run_after_all
|
@hooks.run_after_all
|
||||||
@after_all_hooks_run = true
|
@after_all_hooks_run = true
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Runs all of the `after_each` hooks.
|
# Runs all of the `after_each` hooks.
|
||||||
|
|
Loading…
Reference in a new issue