Fix values being wrapped twice

This simplifies some code.
This commit is contained in:
Michael Miller 2018-09-23 17:13:30 -06:00
parent cf0c438a5d
commit dcbca302dc
2 changed files with 3 additions and 7 deletions

View file

@ -2,9 +2,9 @@ require "./example_group_builder"
module Spectator
module DSL
class GivenExampleGroupBuilder < ExampleGroupBuilder
class GivenExampleGroupBuilder(T) < ExampleGroupBuilder
def initialize(what : String, @collection : Array(Internals::ValueWrapper), @symbol : Symbol)
def initialize(what : String, @collection : Array(T), @symbol : Symbol)
super(what)
end

View file

@ -159,11 +159,7 @@ module Spectator
include {{@type.id}}
def {{to_a_method_name.id}}
Array(::Spectator::Internals::ValueWrapper).new.tap do |array|
{{collection_method_name.id}}.each do |item|
array << ::Spectator::Internals::TypedValueWrapper(typeof(item)).new(item)
end
end
{{collection_method_name.id}}.to_a
end
end
end