Remove type from group macros

This value is never directly seen,
so it isn't necessary to support it.
This commit is contained in:
Michael Miller 2018-09-22 11:38:00 -06:00
parent 110a2b2d2a
commit a82076e2b7

View file

@ -4,12 +4,12 @@ module Spectator
module DSL module DSL
module StructureDSL module StructureDSL
macro describe(what, type = "Describe", &block) macro describe(what, &block)
context({{what}}, {{type}}) {{block}} context({{what}}) {{block}}
end end
macro context(what, type = "Context", &block) macro context(what, &block)
module {{type.id}}%context module Group%group
include {{@type.id}} include {{@type.id}}
::Spectator::Definitions::GROUPS[\{{@type.symbolize}}] = ::Spectator::Definitions::GROUPS[\{{@type.symbolize}}] =
@ -27,7 +27,7 @@ module Spectator
end end
macro given(collection, &block) macro given(collection, &block)
module Given%given module Group%group
include {{@type.id}} include {{@type.id}}
def %collection def %collection
@ -46,7 +46,7 @@ module Spectator
def initialize(locals : Hash(Symbol, ValueWrapper)) def initialize(locals : Hash(Symbol, ValueWrapper))
super super
@%wrapper = locals[:%given] @%wrapper = locals[:%group]
end end
_given_collection Collection%collection, %to_a do _given_collection Collection%collection, %to_a do
@ -58,7 +58,7 @@ module Spectator
GivenExampleGroup(typeof(%to_a.first)).new( GivenExampleGroup(typeof(%to_a.first)).new(
{{collection.stringify}}, {{collection.stringify}},
%to_a, %to_a,
:%given, :%group,
::Spectator::Definitions::GROUPS[{{@type.symbolize}}] ::Spectator::Definitions::GROUPS[{{@type.symbolize}}]
) )