diff --git a/src/spectator.cr b/src/spectator.cr index c5f68a9..0c279ae 100644 --- a/src/spectator.cr +++ b/src/spectator.cr @@ -1,5 +1,5 @@ require "./spectator/includes" -require "./spectator_context" +require "./spectator_test_context" # Module that contains all functionality related to Spectator. module Spectator @@ -38,7 +38,7 @@ module Spectator # For more information on how the DSL works, see the `DSL` module. # Root-level class that contains all examples and example groups. - class SpectatorContext + class ::SpectatorTestContext # Pass off the description argument and block to `DSL::StructureDSL.describe`. # That method will handle creating a new group for this spec. describe({{description}}) {{block}} diff --git a/src/spectator_context.cr b/src/spectator_context.cr index d29aa27..36ff503 100644 --- a/src/spectator_context.cr +++ b/src/spectator_context.cr @@ -4,17 +4,4 @@ # 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 - # Initial implicit subject for tests. - # This method should be overridden by example groups when an object is described. - private def _spectator_implicit_subject - nil - end - - # Initial subject for tests. - # Returns the implicit subject. - # This method should be overridden when an explicit subject is defined by the DSL. - # TODO: Subject needs to be cached. - private def subject - _spectator_implicit_subject - end end diff --git a/src/spectator_test_context.cr b/src/spectator_test_context.cr new file mode 100644 index 0000000..208f5cb --- /dev/null +++ b/src/spectator_test_context.cr @@ -0,0 +1,23 @@ +require "./spectator_context" +require "./spectator/dsl" + +class SpectatorTestContext < SpectatorContext + include ::Spectator::DSL::Groups + + # Initial implicit subject for tests. + # This method should be overridden by example groups when an object is described. + private def _spectator_implicit_subject + nil + end + + # Initial subject for tests. + # Returns the implicit subject. + # This method should be overridden when an explicit subject is defined by the DSL. + # TODO: Subject needs to be cached. + private def subject + _spectator_implicit_subject + end + + # def initialize(@spectator_test_values : ::Spectator::TestValues) + # end +end