From ab146c88c216b2ca297868dc153ae5aa6e7e6dbf Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Sun, 14 Oct 2018 17:43:33 -0600 Subject: [PATCH] Bit of code cleanup --- src/spectator/dsl/builder.cr | 8 ++++---- src/spectator/dsl/example_group_builder.cr | 2 +- src/spectator/dsl/given_example_group_builder.cr | 2 +- src/spectator/dsl/nested_example_group_builder.cr | 2 +- src/spectator/dsl/root_example_group_builder.cr | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/spectator/dsl/builder.cr b/src/spectator/dsl/builder.cr index e4f2cea..e19bbc4 100644 --- a/src/spectator/dsl/builder.cr +++ b/src/spectator/dsl/builder.cr @@ -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 diff --git a/src/spectator/dsl/example_group_builder.cr b/src/spectator/dsl/example_group_builder.cr index 86ab72e..9d939e4 100644 --- a/src/spectator/dsl/example_group_builder.cr +++ b/src/spectator/dsl/example_group_builder.cr @@ -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, diff --git a/src/spectator/dsl/given_example_group_builder.cr b/src/spectator/dsl/given_example_group_builder.cr index eca71d9..c174e29 100644 --- a/src/spectator/dsl/given_example_group_builder.cr +++ b/src/spectator/dsl/given_example_group_builder.cr @@ -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 diff --git a/src/spectator/dsl/nested_example_group_builder.cr b/src/spectator/dsl/nested_example_group_builder.cr index 72d53f6..289839f 100644 --- a/src/spectator/dsl/nested_example_group_builder.cr +++ b/src/spectator/dsl/nested_example_group_builder.cr @@ -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 diff --git a/src/spectator/dsl/root_example_group_builder.cr b/src/spectator/dsl/root_example_group_builder.cr index fcc82c1..6321d25 100644 --- a/src/spectator/dsl/root_example_group_builder.cr +++ b/src/spectator/dsl/root_example_group_builder.cr @@ -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