Move top-level types into spectator/ sub-directory

This commit is contained in:
Michael Miller 2021-01-09 13:56:32 -07:00
parent 7451769a29
commit fb0423ed02
No known key found for this signature in database
GPG key ID: F9A0C5C65B162436
5 changed files with 14 additions and 14 deletions

View file

@ -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.

View file

@ -8,3 +8,4 @@ require "./command_line_arguments_config_source"
require "./config_builder"
require "./config"
require "./dsl"
require "./test_context"

View file

@ -0,0 +1,26 @@
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
include ::Spectator::DSL::Hooks
# 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