Remove unused code

This commit is contained in:
Michael Miller 2018-10-14 01:02:52 -06:00
parent 77f631205e
commit 68412daec0

View file

@ -11,21 +11,11 @@ module Spectator
private getter! children : Array(Child) private getter! children : Array(Child)
setter children setter children
private getter hooks : ExampleHooks def initialize(@what, @parent, @hooks : ExampleHooks)
def initialize(@what, @parent, @hooks)
@before_all_hooks_run = false @before_all_hooks_run = false
@after_all_hooks_run = false @after_all_hooks_run = false
end end
def examples : Enumerable(Example)
children.compact_map &.as?(Example)
end
def groups : Enumerable(ExampleGroup)
children.compact_map &.as?(ExampleGroup)
end
def example_count def example_count
children.sum do |child| children.sum do |child|
child.is_a?(Example) ? 1 : child.example_count child.is_a?(Example) ? 1 : child.example_count
@ -49,7 +39,7 @@ module Spectator
parent.run_before_all_hooks parent.run_before_all_hooks
end end
unless @before_all_hooks_run unless @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 end
@ -58,13 +48,13 @@ module Spectator
if (parent = @parent) if (parent = @parent)
parent.run_before_each_hooks parent.run_before_each_hooks
end end
hooks.run_before_each @hooks.run_before_each
end end
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?) if all_examples.all?(&.finished?)
hooks.run_after_all @hooks.run_after_all
@after_all_hooks_run = true @after_all_hooks_run = true
end end
end end
@ -74,14 +64,14 @@ module Spectator
end end
def run_after_each_hooks def run_after_each_hooks
hooks.run_after_each @hooks.run_after_each
if (parent = @parent) if (parent = @parent)
parent.run_after_each_hooks parent.run_after_each_hooks
end end
end end
def wrap_around_each_hooks(&block : ->) def wrap_around_each_hooks(&block : ->)
wrapper = hooks.wrap_around_each(&block) wrapper = @hooks.wrap_around_each(&block)
if (parent = @parent) if (parent = @parent)
wrapper = parent.wrap_around_each_hooks(&wrapper) wrapper = parent.wrap_around_each_hooks(&wrapper)
end end