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.
|
# Use `#each` to enumerate over all tests in the suite.
|
||||||
class TestSuite
|
class TestSuite
|
||||||
include Enumerable(Example)
|
include Enumerable(Example)
|
||||||
|
include Iterable(Example)
|
||||||
|
|
||||||
# Creates the test suite.
|
# Creates the test suite.
|
||||||
# The example *group* provided will be run.
|
# The example *group* provided will be run.
|
||||||
|
@ -11,13 +12,13 @@ module Spectator
|
||||||
|
|
||||||
# Yields each example in the test suite.
|
# Yields each example in the test suite.
|
||||||
def each : Nil
|
def each : Nil
|
||||||
iterator.each do |example|
|
each.each do |example|
|
||||||
yield example
|
yield example
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Creates an iterator for the example group.
|
# Returns an iterator that yields all examples in the test suite.
|
||||||
private def iterator
|
def each : Iterator(Example)
|
||||||
ExampleIterator.new(@group)
|
ExampleIterator.new(@group)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue