From 00a249502791117abfa6e332103489d9e1df8a4e Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Sat, 31 Aug 2019 13:11:59 -0600 Subject: [PATCH] Change test root to SpectatorTest --- src/spectator.cr | 8 +++----- src/spectator_test.cr | 10 ++++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 src/spectator_test.cr diff --git a/src/spectator.cr b/src/spectator.cr index 5cb84d7..3a088c4 100644 --- a/src/spectator.cr +++ b/src/spectator.cr @@ -1,4 +1,5 @@ require "./spectator/includes" +require "./spectator_test" # Module that contains all functionality related to Spectator. module Spectator @@ -32,15 +33,12 @@ module Spectator # We don't want the spec code to accidentally pickup types and values from the `Spectator` module. # Another reason is that we need a root module to put all examples and groups in. # And lastly, the spec DSL needs to be given to the block of code somehow. - # The DSL is included in the `SpectatorExamples` module. + # The DSL is included in the `SpectatorTest` class. # # For more information on how the DSL works, see the `DSL` module. # Root-level class that contains all examples and example groups. - class SpectatorExamples - include ::Spectator::DSL::StructureDSL # Include the DSL for creating groups, example, and more. - include ::Spectator::DSL::ExampleDSL # Mix in methods and macros specifically for example DSL. - + class SpectatorTest # Pass off the "what" argument and block to `DSL::StructureDSL.describe`. # That method will handle creating a new group for this spec. describe({{what}}) {{block}} diff --git a/src/spectator_test.cr b/src/spectator_test.cr new file mode 100644 index 0000000..439ceb9 --- /dev/null +++ b/src/spectator_test.cr @@ -0,0 +1,10 @@ +require "./spectator/dsl/example_dsl" +require "./spectator/dsl/structure_dsl" + +# Root-level class that all tests inherit from and are contained in. +# This class is intentionally outside of the scope of Spectator, +# so that the namespace isn't leaked into tests unexpectedly. +class SpectatorTest + include ::Spectator::DSL::StructureDSL # Include the DSL for creating groups, example, and more. + include ::Spectator::DSL::ExampleDSL # Mix in methods and macros specifically for example DSL. +end