mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Move top-level types into spectator/ sub-directory
This commit is contained in:
parent
7451769a29
commit
fb0423ed02
5 changed files with 14 additions and 14 deletions
|
@ -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.
|
||||
|
|
|
@ -8,3 +8,4 @@ require "./command_line_arguments_config_source"
|
|||
require "./config_builder"
|
||||
require "./config"
|
||||
require "./dsl"
|
||||
require "./test_context"
|
||||
|
|
26
src/spectator/test_context.cr
Normal file
26
src/spectator/test_context.cr
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue