From 56ae92a25d30989d024bd08977fd41c6c16add81 Mon Sep 17 00:00:00 2001 From: Michael Miller Date: Sun, 23 Sep 2018 14:45:36 -0600 Subject: [PATCH] Add symbol for getting local from #given --- src/spectator/dsl/given_example_group_builder.cr | 4 ++-- src/spectator/dsl/structure_dsl.cr | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/spectator/dsl/given_example_group_builder.cr b/src/spectator/dsl/given_example_group_builder.cr index 7b53532..e1e50d9 100644 --- a/src/spectator/dsl/given_example_group_builder.cr +++ b/src/spectator/dsl/given_example_group_builder.cr @@ -4,7 +4,7 @@ module Spectator module DSL class GivenExampleGroupBuilder < ExampleGroupBuilder - def initialize(what : String, @collection : Array(ValueWrapper)) + def initialize(what : String, @collection : Array(ValueWrapper), @symbol : Symbol) super(what) end @@ -12,7 +12,7 @@ module Spectator ExampleGroup.new(@what, parent).tap do |group| children = [] of ExampleGroup::Child @collection.each do |value| - iter_locals = locals.merge({:TODO => value}) + iter_locals = locals.merge({@symbol => value}) iter_children = @children.map do |child| child.build(group, iter_locals) end diff --git a/src/spectator/dsl/structure_dsl.cr b/src/spectator/dsl/structure_dsl.cr index 802f844..6118ba7 100644 --- a/src/spectator/dsl/structure_dsl.cr +++ b/src/spectator/dsl/structure_dsl.cr @@ -59,7 +59,8 @@ module Spectator ::Spectator::DSL::Builder.start_given_group( {{collection.stringify}}, - %to_a + %to_a, + :%group ) {{block.body}}