mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Store "what" string in context
This commit is contained in:
parent
284e10482a
commit
d8621fc43e
3 changed files with 4 additions and 3 deletions
|
@ -4,7 +4,7 @@ require "./spectator/*"
|
||||||
module Spectator
|
module Spectator
|
||||||
VERSION = "0.1.0"
|
VERSION = "0.1.0"
|
||||||
|
|
||||||
ROOT_CONTEXT = Context.new
|
ROOT_CONTEXT = Context.new("ROOT")
|
||||||
|
|
||||||
macro describe(what, source_file = __FILE__, source_line = __LINE__, &block)
|
macro describe(what, source_file = __FILE__, source_line = __LINE__, &block)
|
||||||
module Spectator
|
module Spectator
|
||||||
|
|
|
@ -2,6 +2,7 @@ require "./example"
|
||||||
|
|
||||||
module Spectator
|
module Spectator
|
||||||
class Context
|
class Context
|
||||||
|
getter what : String
|
||||||
getter parent : Context?
|
getter parent : Context?
|
||||||
getter examples = [] of Example
|
getter examples = [] of Example
|
||||||
getter contexts = [] of Context
|
getter contexts = [] of Context
|
||||||
|
@ -14,7 +15,7 @@ module Spectator
|
||||||
@before_all_hooks_run = false
|
@before_all_hooks_run = false
|
||||||
@after_all_hooks_run = false
|
@after_all_hooks_run = false
|
||||||
|
|
||||||
def initialize(@parent = nil)
|
def initialize(@what, @parent = nil)
|
||||||
if (parent = @parent)
|
if (parent = @parent)
|
||||||
parent.contexts << self
|
parent.contexts << self
|
||||||
end
|
end
|
||||||
|
|
|
@ -49,7 +49,7 @@ module Spectator
|
||||||
include ::Spectator::DSL
|
include ::Spectator::DSL
|
||||||
|
|
||||||
PARENT_CONTEXT = {{context_module.id}}::CURRENT_CONTEXT
|
PARENT_CONTEXT = {{context_module.id}}::CURRENT_CONTEXT
|
||||||
CURRENT_CONTEXT = ::Spectator::Context.new(PARENT_CONTEXT)
|
CURRENT_CONTEXT = ::Spectator::Context.new({{what.stringify}}, PARENT_CONTEXT)
|
||||||
|
|
||||||
CONTEXT_MODULE = {{context_module.id}}::{{module_name.id}}
|
CONTEXT_MODULE = {{context_module.id}}::{{module_name.id}}
|
||||||
GIVEN_VARIABLES = [
|
GIVEN_VARIABLES = [
|
||||||
|
|
Loading…
Reference in a new issue