mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Implement Iterable
This commit is contained in:
parent
d0ba2c5400
commit
29279e1812
1 changed files with 4 additions and 3 deletions
|
@ -3,6 +3,7 @@ module Spectator
|
|||
# Use `#each` to enumerate over all tests in the suite.
|
||||
class TestSuite
|
||||
include Enumerable(Example)
|
||||
include Iterable(Example)
|
||||
|
||||
# Creates the test suite.
|
||||
# The example *group* provided will be run.
|
||||
|
@ -11,13 +12,13 @@ module Spectator
|
|||
|
||||
# Yields each example in the test suite.
|
||||
def each : Nil
|
||||
iterator.each do |example|
|
||||
each.each do |example|
|
||||
yield example
|
||||
end
|
||||
end
|
||||
|
||||
# Creates an iterator for the example group.
|
||||
private def iterator
|
||||
# Returns an iterator that yields all examples in the test suite.
|
||||
def each : Iterator(Example)
|
||||
ExampleIterator.new(@group)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue