shard-spectator/src/spectator/runner.cr
Michael Miller 6c882f9cae Remove ExampleGroup#all_examples
Implement the same functionality with ExampleIterator.
2018-11-13 10:08:37 -07:00

22 lines
649 B
Crystal

module Spectator
class Runner
def initialize(@group : ExampleGroup,
@formatter : Formatters::Formatter = Formatters::DefaultFormatter.new)
end
def run : Nil
iterator = ExampleIterator.new(@group)
results = [] of Result
elapsed = Time.measure do
@formatter.start_suite
results = iterator.map do |example|
@formatter.start_example(example)
Internals::Harness.run(example).tap do |result|
@formatter.end_example(result)
end.as(Result)
end.to_a
end
@formatter.end_suite(TestResults.new(results, elapsed))
end
end
end