From 7ff91b4fc642d2b63d665cac0b5c3d5e859ec414 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Tue, 4 Sep 2018 16:17:33 -0600 Subject: [PATCH] Rename "context" to "locals" Remove possible confusion around variables (let and subject) and context keyword. --- src/spectator/dsl.cr | 14 +++++++------- src/spectator/examples.cr | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/spectator/dsl.cr b/src/spectator/dsl.cr index b96391d..a0fa838 100644 --- a/src/spectator/dsl.cr +++ b/src/spectator/dsl.cr @@ -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 diff --git a/src/spectator/examples.cr b/src/spectator/examples.cr index beed9b4..d812dca 100644 --- a/src/spectator/examples.cr +++ b/src/spectator/examples.cr @@ -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