This commit is contained in:
Michael Miller 2019-02-10 23:05:16 -07:00
parent 55b655e90a
commit 3d67c45a22

View file

@ -1,17 +1,22 @@
module Spectator module Spectator
# Encapsulates the tests to run and additional properties about them. # Encapsulates the tests to run and additional properties about them.
# Use `#each` to enumerate over all tests in the suite.
class TestSuite class TestSuite
include Enumerable(Example) include Enumerable(Example)
# Creates the test suite.
# The example `group` provided will be run.
def initialize(@group : ExampleGroup) def initialize(@group : ExampleGroup)
end end
def each # Yields each example in the test suite.
def each : Nil
iterator.each do |example| iterator.each do |example|
yield example yield example
end end
end end
# Creates an iterator for the example group.
private def iterator private def iterator
ExampleIterator.new(@group) ExampleIterator.new(@group)
end end