2018-10-14 23:10:12 +00:00
|
|
|
require "./example_group"
|
|
|
|
|
|
|
|
module Spectator
|
|
|
|
class NestedExampleGroup < ExampleGroup
|
|
|
|
getter what : String
|
|
|
|
|
2018-10-15 00:00:55 +00:00
|
|
|
getter parent : ExampleGroup
|
2018-10-14 23:10:12 +00:00
|
|
|
|
|
|
|
def initialize(@what, @parent, hooks : ExampleHooks)
|
|
|
|
super(hooks)
|
|
|
|
end
|
|
|
|
|
|
|
|
def run_before_all_hooks : Nil
|
2018-10-15 00:00:55 +00:00
|
|
|
parent.run_before_all_hooks
|
2018-10-14 23:10:12 +00:00
|
|
|
super
|
|
|
|
end
|
|
|
|
|
|
|
|
def run_before_each_hooks : Nil
|
2018-10-15 00:00:55 +00:00
|
|
|
parent.run_before_each_hooks
|
2018-10-14 23:10:12 +00:00
|
|
|
super
|
|
|
|
end
|
|
|
|
|
|
|
|
def run_after_all_hooks : Nil
|
|
|
|
super
|
2018-10-15 00:00:55 +00:00
|
|
|
parent.run_after_all_hooks
|
2018-10-14 23:10:12 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def run_after_each_hooks : Nil
|
|
|
|
super
|
2018-10-15 00:00:55 +00:00
|
|
|
parent.run_after_each_hooks
|
2018-10-14 23:10:12 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def wrap_around_each_hooks(&block : ->) : ->
|
2018-10-15 00:00:55 +00:00
|
|
|
wrapper = super(&block)
|
|
|
|
parent.wrap_around_each_hooks(&wrapper)
|
2018-10-14 23:10:12 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def to_s(io)
|
2018-10-15 00:00:55 +00:00
|
|
|
parent.to_s(io)
|
|
|
|
io << ' '
|
2018-10-14 23:10:12 +00:00
|
|
|
io << what
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|