mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Rename "context" to "locals"
Remove possible confusion around variables (let and subject) and context keyword.
This commit is contained in:
parent
de55e31407
commit
7ff91b4fc6
2 changed files with 9 additions and 9 deletions
|
@ -9,14 +9,14 @@ module Spectator
|
|||
macro context(what, source_file = __FILE__, source_line = __LINE__, type = "Context", &block)
|
||||
{% safe_name = what.id.stringify.gsub(/\W+/, "_") %}
|
||||
{% module_name = (type.id + safe_name.camelcase).id %}
|
||||
{% parent_context_name = PARENT_CONTEXT_NAME %}
|
||||
{% parent_locals_module = PARENT_LOCALS_MODULE %}
|
||||
module {{module_name.id}}
|
||||
include ::Spectator::DSL
|
||||
|
||||
PARENT_CONTEXT_NAME = {{parent_context_name.id}}::{{module_name.id}}
|
||||
PARENT_LOCALS_MODULE = {{parent_locals_module.id}}::{{module_name.id}}
|
||||
|
||||
module Context
|
||||
include {{parent_context_name.id}}::Context
|
||||
module Locals
|
||||
include {{parent_locals_module.id}}::Locals
|
||||
end
|
||||
|
||||
{{block.body}}
|
||||
|
@ -27,7 +27,7 @@ module Spectator
|
|||
{% safe_name = description.id.stringify.gsub(/\W+/, "_") %}
|
||||
{% class_name = (safe_name.camelcase + "Example").id %}
|
||||
class {{class_name.id}} < ::Spectator::Example
|
||||
include Context
|
||||
include Locals
|
||||
|
||||
def source
|
||||
Source.new({{source_file}}, {{source_line}})
|
||||
|
@ -52,7 +52,7 @@ module Spectator
|
|||
macro let(name, &block)
|
||||
let!({{name}}!) {{block}}
|
||||
|
||||
module Context
|
||||
module Locals
|
||||
@_%wrapper : ValueWrapper?
|
||||
|
||||
def {{name.id}}
|
||||
|
@ -68,7 +68,7 @@ module Spectator
|
|||
end
|
||||
|
||||
macro let!(name, &block)
|
||||
module Context
|
||||
module Locals
|
||||
def {{name.id}}
|
||||
{{block.body}}
|
||||
end
|
||||
|
|
|
@ -4,9 +4,9 @@ module Spectator
|
|||
module Examples
|
||||
include ::Spectator::DSL
|
||||
|
||||
PARENT_CONTEXT_NAME = ::Spectator::Examples
|
||||
PARENT_LOCALS_MODULE = ::Spectator::Examples
|
||||
|
||||
module Context
|
||||
module Locals
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue