mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Use label in sub-group name
This commit is contained in:
parent
c3ea34e762
commit
1f300a4a18
2 changed files with 3 additions and 3 deletions
|
@ -38,7 +38,7 @@ module Spectator
|
|||
end
|
||||
|
||||
class Context%sample < {{@type.id}}
|
||||
::Spectator::SpecBuilder.start_sample_group({{collection.stringify}}, :%sample) do |values|
|
||||
::Spectator::SpecBuilder.start_sample_group({{collection.stringify}}, :%sample, {{block_arg.stringify}}) do |values|
|
||||
sample = {{@type.id}}.new(values)
|
||||
sample.%to_a
|
||||
end
|
||||
|
|
|
@ -2,7 +2,7 @@ require "./nested_example_group_builder"
|
|||
|
||||
module Spectator::SpecBuilder
|
||||
class SampleExampleGroupBuilder(T) < NestedExampleGroupBuilder
|
||||
def initialize(what : String | Symbol, @id : Symbol, @collection_builder : TestValues -> Array(T))
|
||||
def initialize(what : String | Symbol, @id : Symbol, @label : String, @collection_builder : TestValues -> Array(T))
|
||||
super(what)
|
||||
end
|
||||
|
||||
|
@ -20,7 +20,7 @@ module Spectator::SpecBuilder
|
|||
private def build_sub_group(parent_group, element)
|
||||
values = parent_group.context.values.add(@id, @what.to_s, element)
|
||||
context = TestContext.new(parent_group.context, ExampleHooks.empty, values)
|
||||
NestedExampleGroup.new(element.inspect, parent_group, context).tap do |group|
|
||||
NestedExampleGroup.new("#{@label} = #{element.inspect}", parent_group, context).tap do |group|
|
||||
group.children = children.map do |child|
|
||||
child.build(group).as(ExampleComponent)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue