Fix sample iteration with single block arg (not tuple)

This commit is contained in:
Michael Miller 2022-01-26 13:14:30 -07:00
parent 4e7318b964
commit 92e839415d
No known key found for this signature in database
GPG key ID: AC78B32D30CE34A2
3 changed files with 43 additions and 3 deletions

View file

@ -101,9 +101,15 @@ module Spectator::DSL
)
\{% if block %}
\{% for arg, i in block.args %}
let(\{{arg}}) do |example|
example.group.as(::Spectator::ExampleGroupIteration(typeof(Group\%group.\%collection.first))).item[\{{i}}]
\{% if block.args.size > 1 %}
\{% for arg, i in block.args %}
let(\{{arg}}) do |example|
example.group.as(::Spectator::ExampleGroupIteration(typeof(Group\%group.\%collection.first))).item[\{{i}}]
end
\{% end %}
\{% else %}
let(\{{block.args[0]}}) do |example|
example.group.as(::Spectator::ExampleGroupIteration(typeof(Group\%group.\%collection.first))).item
end
\{% end %}