From fb0423ed02fc343b8756b3cd847cb259522687d2 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Sat, 9 Jan 2021 13:56:32 -0700 Subject: [PATCH] Move top-level types into spectator/ sub-directory --- src/spectator.cr | 1 - src/spectator/context.cr | 8 +++++++- src/spectator/includes.cr | 1 + .../test_context.cr} | 11 ++++++----- src/spectator_context.cr | 7 ------- 5 files changed, 14 insertions(+), 14 deletions(-) rename src/{spectator_test_context.cr => spectator/test_context.cr} (65%) delete mode 100644 src/spectator_context.cr diff --git a/src/spectator.cr b/src/spectator.cr index 4f29bc8..a27367c 100644 --- a/src/spectator.cr +++ b/src/spectator.cr @@ -1,6 +1,5 @@ require "log" require "./spectator/includes" -require "./spectator_test_context" Log.setup_from_env diff --git a/src/spectator/context.cr b/src/spectator/context.cr index 9a4607e..c0a12db 100644 --- a/src/spectator/context.cr +++ b/src/spectator/context.cr @@ -1,4 +1,10 @@ -require "../spectator_context" +# Base class that all test cases run in. +# This type is used to store all test case contexts as a single type. +# The instance must be downcast to the correct type before calling a context method. +# This type is intentionally outside the `Spectator` module. +# The reason for this is to prevent name collision when using the DSL to define a spec. +abstract class SpectatorContext +end module Spectator # Base class that all test cases run in. diff --git a/src/spectator/includes.cr b/src/spectator/includes.cr index 9b270a8..5fa8f02 100644 --- a/src/spectator/includes.cr +++ b/src/spectator/includes.cr @@ -8,3 +8,4 @@ require "./command_line_arguments_config_source" require "./config_builder" require "./config" require "./dsl" +require "./test_context" diff --git a/src/spectator_test_context.cr b/src/spectator/test_context.cr similarity index 65% rename from src/spectator_test_context.cr rename to src/spectator/test_context.cr index 0e8fb2b..83905cf 100644 --- a/src/spectator_test_context.cr +++ b/src/spectator/test_context.cr @@ -1,6 +1,10 @@ -require "./spectator_context" -require "./spectator/dsl" +require "./context" +require "./dsl" +# Class used as the base for all specs using the DSL. +# It adds methods and macros necessary to use the DSL from the spec. +# This type is intentionally outside the `Spectator` module. +# The reason for this is to prevent name collision when using the DSL to define a spec. class SpectatorTestContext < SpectatorContext include ::Spectator::DSL::Examples include ::Spectator::DSL::Groups @@ -19,7 +23,4 @@ class SpectatorTestContext < SpectatorContext private def subject _spectator_implicit_subject end - - # def initialize(@spectator_test_values : ::Spectator::TestValues) - # end end diff --git a/src/spectator_context.cr b/src/spectator_context.cr deleted file mode 100644 index 36ff503..0000000 --- a/src/spectator_context.cr +++ /dev/null @@ -1,7 +0,0 @@ -# Base class that all test cases run in. -# This type is used to store all test case contexts as a single type. -# The instance must be downcast to the correct type before calling a context method. -# This type is intentionally outside the `Spectator` module. -# The reason for this is to prevent name collision when using the DSL to define a spec. -abstract class SpectatorContext -end