Update Runner to not use Iterable#each
This commit is contained in:
Michael Miller 2019-03-25 11:29:20 -06:00
parent 3654b2473b
commit 49c396714e
2 changed files with 5 additions and 8 deletions

View file

@ -42,10 +42,8 @@ module Spectator
# The order of examples is randomized
# if specified by the configuration.
private def example_order
if @config.randomize?
@suite.to_a.shuffle!(@config.random)
else
@suite.each
@suite.to_a.tap do |examples|
examples.shuffle!(@config.random) if @config.randomize?
end
end

View file

@ -3,7 +3,6 @@ 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.
@ -12,13 +11,13 @@ module Spectator
# Yields each example in the test suite.
def each : Nil
each.each do |example|
iterator.each do |example|
yield example
end
end
# Returns an iterator that yields all examples in the test suite.
def each : Iterator(Example)
# Creates an iterator for the example group.
private def iterator
ExampleIterator.new(@group)
end
end