2021-07-17 18:06:53 +00:00
|
|
|
require "./example_group"
|
2021-07-17 20:01:27 +00:00
|
|
|
require "./label"
|
|
|
|
require "./location"
|
|
|
|
require "./metadata"
|
2021-07-17 18:06:53 +00:00
|
|
|
|
|
|
|
module Spectator
|
2021-07-17 20:01:27 +00:00
|
|
|
# Collection of examples and sub-groups for a single iteration of an iterative example group.
|
2021-07-17 18:06:53 +00:00
|
|
|
class ExampleGroupIteration(T) < ExampleGroup
|
2021-07-17 20:01:27 +00:00
|
|
|
# Item for this iteration of the example groups.
|
2021-07-17 18:07:04 +00:00
|
|
|
getter item : T
|
|
|
|
|
2021-07-17 20:01:27 +00:00
|
|
|
# Creates the example group iteration.
|
|
|
|
# The element for the current iteration is provided by *item*.
|
|
|
|
# The *name* describes the purpose of the group.
|
|
|
|
# It can be a `Symbol` to describe a type.
|
|
|
|
# This is typically a stringified form of *item*.
|
|
|
|
# The *location* tracks where the group exists in source code.
|
|
|
|
# This group will be assigned to the parent *group* if it is provided.
|
|
|
|
# A set of *metadata* can be used for filtering and modifying example behavior.
|
2021-07-17 18:06:53 +00:00
|
|
|
def initialize(@item : T, name : Label = nil, location : Location? = nil,
|
|
|
|
group : ExampleGroup? = nil, metadata : Metadata = Metadata.new)
|
|
|
|
super(name, location, group, metadata)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|