mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
parent
3654b2473b
commit
49c396714e
2 changed files with 5 additions and 8 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue