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}}
|
||||
end
|
||||
|
||||
macro sample(what, &block)
|
||||
macro sample(collection, &block)
|
||||
{% block_arg = block.args.empty? ? :value.id : block.args.first.id %}
|
||||
class Sample%sample < {{@type.id}}
|
||||
def %collection
|
||||
{{what}}
|
||||
end
|
||||
|
||||
def %collection
|
||||
{{collection}}
|
||||
end
|
||||
|
||||
def %to_a
|
||||
%collection.to_a
|
||||
end
|
||||
|
||||
class Context%sample < {{@type.id}}
|
||||
::Spectator::SpecBuilder.start_sample_group({{what.stringify}}, :%sample) do |values|
|
||||
sample = Sample%sample.new(values)
|
||||
sample.%collection.to_a
|
||||
::Spectator::SpecBuilder.start_sample_group({{collection.stringify}}, :%sample) do |values|
|
||||
sample = {{@type.id}}.new(values)
|
||||
sample.%to_a
|
||||
end
|
||||
|
||||
def {{block_arg}}
|
||||
1
|
||||
@spectator_test_values.get_value(:%sample, typeof(%to_a.first))
|
||||
end
|
||||
|
||||
{{block.body}}
|
||||
|
|
Loading…
Reference in a new issue