mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Parent group can't be nil for nested group
This commit is contained in:
parent
ab146c88c2
commit
1a2cba79fc
1 changed files with 9 additions and 22 deletions
|
@ -4,53 +4,40 @@ module Spectator
|
||||||
class NestedExampleGroup < ExampleGroup
|
class NestedExampleGroup < ExampleGroup
|
||||||
getter what : String
|
getter what : String
|
||||||
|
|
||||||
getter! parent : ExampleGroup
|
getter parent : ExampleGroup
|
||||||
|
|
||||||
def initialize(@what, @parent, hooks : ExampleHooks)
|
def initialize(@what, @parent, hooks : ExampleHooks)
|
||||||
super(hooks)
|
super(hooks)
|
||||||
end
|
end
|
||||||
|
|
||||||
def run_before_all_hooks : Nil
|
def run_before_all_hooks : Nil
|
||||||
if (parent = @parent)
|
|
||||||
parent.run_before_all_hooks
|
parent.run_before_all_hooks
|
||||||
end
|
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
def run_before_each_hooks : Nil
|
def run_before_each_hooks : Nil
|
||||||
if (parent = @parent)
|
|
||||||
parent.run_before_each_hooks
|
parent.run_before_each_hooks
|
||||||
end
|
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
def run_after_all_hooks : Nil
|
def run_after_all_hooks : Nil
|
||||||
super
|
super
|
||||||
if (parent = @parent)
|
|
||||||
parent.run_after_all_hooks
|
parent.run_after_all_hooks
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def run_after_each_hooks : Nil
|
def run_after_each_hooks : Nil
|
||||||
super
|
super
|
||||||
if (parent = @parent)
|
|
||||||
parent.run_after_each_hooks
|
parent.run_after_each_hooks
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def wrap_around_each_hooks(&block : ->) : ->
|
def wrap_around_each_hooks(&block : ->) : ->
|
||||||
super(&block).tap do |wrapper|
|
wrapper = super(&block)
|
||||||
if (parent = @parent)
|
parent.wrap_around_each_hooks(&wrapper)
|
||||||
wrapper = parent.wrap_around_each_hooks(&wrapper)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_s(io)
|
def to_s(io)
|
||||||
if (parent = @parent)
|
|
||||||
parent.to_s(io)
|
parent.to_s(io)
|
||||||
io << ' '
|
io << ' '
|
||||||
end
|
|
||||||
io << what
|
io << what
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue