mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Bit of code cleanup
This commit is contained in:
parent
bff6d463df
commit
ab146c88c2
5 changed files with 8 additions and 8 deletions
|
@ -4,7 +4,7 @@ module Spectator::DSL
|
|||
|
||||
@@group_stack = Array(ExampleGroupBuilder).new(1, root_group)
|
||||
|
||||
private class_getter root_group = RootExampleGroupBuilder.new()
|
||||
private class_getter root_group = RootExampleGroupBuilder.new
|
||||
|
||||
private def current_group
|
||||
@@group_stack.last
|
||||
|
@ -16,12 +16,12 @@ module Spectator::DSL
|
|||
end
|
||||
|
||||
def start_group(*args) : Nil
|
||||
group = ::Spectator::DSL::NestedExampleGroupBuilder.new(*args)
|
||||
group = NestedExampleGroupBuilder.new(*args)
|
||||
push_group(group)
|
||||
end
|
||||
|
||||
def start_given_group(*args) : Nil
|
||||
group = ::Spectator::DSL::GivenExampleGroupBuilder.new(*args)
|
||||
group = GivenExampleGroupBuilder.new(*args)
|
||||
push_group(group)
|
||||
end
|
||||
|
||||
|
@ -30,7 +30,7 @@ module Spectator::DSL
|
|||
end
|
||||
|
||||
def add_example(example_type : Example.class) : Nil
|
||||
factory = ::Spectator::DSL::ExampleFactory.new(example_type)
|
||||
factory = ExampleFactory.new(example_type)
|
||||
current_group.add_child(factory)
|
||||
end
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ module Spectator::DSL
|
|||
@around_each_hooks << block
|
||||
end
|
||||
|
||||
private def build_hooks
|
||||
private def hooks
|
||||
ExampleHooks.new(
|
||||
@before_all_hooks,
|
||||
@before_each_hooks,
|
||||
|
|
|
@ -7,7 +7,7 @@ module Spectator::DSL
|
|||
end
|
||||
|
||||
def build(parent : ExampleGroup, sample_values : Internals::SampleValues) : NestedExampleGroup
|
||||
NestedExampleGroup.new(@what, parent, build_hooks).tap do |group|
|
||||
NestedExampleGroup.new(@what, parent, hooks).tap do |group|
|
||||
group.children = @collection.map do |value|
|
||||
build_sub_group(group, sample_values, value).as(ExampleComponent)
|
||||
end
|
||||
|
|
|
@ -8,7 +8,7 @@ module Spectator::DSL
|
|||
end
|
||||
|
||||
def build(parent : ExampleGroup, sample_values : Internals::SampleValues) : NestedExampleGroup
|
||||
NestedExampleGroup.new(@what, parent, build_hooks).tap do |group|
|
||||
NestedExampleGroup.new(@what, parent, hooks).tap do |group|
|
||||
group.children = @children.map do |child|
|
||||
child.build(group, sample_values).as(ExampleComponent)
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module Spectator::DSL
|
||||
class RootExampleGroupBuilder < ExampleGroupBuilder
|
||||
def build(sample_values : Internals::SampleValues) : RootExampleGroup
|
||||
RootExampleGroup.new(build_hooks).tap do |group|
|
||||
RootExampleGroup.new(hooks).tap do |group|
|
||||
group.children = @children.map do |child|
|
||||
child.build(group, sample_values).as(ExampleComponent)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue