mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Retrieve test value for sample group
This commit is contained in:
parent
f6e95719ad
commit
c3ea34e762
1 changed files with 12 additions and 9 deletions
|
@ -26,22 +26,25 @@ module Spectator
|
||||||
context({{what}}) {{block}}
|
context({{what}}) {{block}}
|
||||||
end
|
end
|
||||||
|
|
||||||
macro sample(what, &block)
|
macro sample(collection, &block)
|
||||||
{% block_arg = block.args.empty? ? :value.id : block.args.first.id %}
|
{% block_arg = block.args.empty? ? :value.id : block.args.first.id %}
|
||||||
class Sample%sample < {{@type.id}}
|
|
||||||
def %collection
|
def %collection
|
||||||
{{what}}
|
{{collection}}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def %to_a
|
||||||
|
%collection.to_a
|
||||||
end
|
end
|
||||||
|
|
||||||
class Context%sample < {{@type.id}}
|
class Context%sample < {{@type.id}}
|
||||||
::Spectator::SpecBuilder.start_sample_group({{what.stringify}}, :%sample) do |values|
|
::Spectator::SpecBuilder.start_sample_group({{collection.stringify}}, :%sample) do |values|
|
||||||
sample = Sample%sample.new(values)
|
sample = {{@type.id}}.new(values)
|
||||||
sample.%collection.to_a
|
sample.%to_a
|
||||||
end
|
end
|
||||||
|
|
||||||
def {{block_arg}}
|
def {{block_arg}}
|
||||||
1
|
@spectator_test_values.get_value(:%sample, typeof(%to_a.first))
|
||||||
end
|
end
|
||||||
|
|
||||||
{{block.body}}
|
{{block.body}}
|
||||||
|
|
Loading…
Reference in a new issue