Fix let/subject not being passed to nested contexts

This commit is contained in:
Michael Miller 2018-08-30 14:02:18 -06:00
parent 24725c4f9d
commit e26fecd092
2 changed files with 9 additions and 0 deletions

View file

@ -13,10 +13,14 @@ module Spectator
macro context(what, type = "Context", &block)
{% safe_name = what.id.stringify.gsub(/\W+/, "_") %}
{% module_name = (type.id + safe_name.camelcase).id %}
{% parent_context_name = PARENT_CONTEXT_NAME %}
module {{module_name.id}}
include ::Spectator::DSL
PARENT_CONTEXT_NAME = {{parent_context_name.id}}::{{module_name.id}}
module Context
include {{parent_context_name.id}}::Context
end
{{block.body}}

View file

@ -3,5 +3,10 @@ require "./dsl"
module Spectator
module Examples
include ::Spectator::DSL
PARENT_CONTEXT_NAME = ::Spectator::Examples
module Context
end
end
end