Ability to enumerate each result in report

This commit is contained in:
Michael Miller 2019-03-23 14:44:00 -06:00
parent 4d38bf3ab2
commit 4890cafefa
2 changed files with 20 additions and 0 deletions

View file

@ -1,6 +1,10 @@
require "./result"
module Spectator
# Outcome of all tests in a suite.
class Report
include Enumerable(Result)
# Total length of time it took to execute the test suite.
# This includes examples, hooks, and framework processes.
getter runtime : Time::Span
@ -51,6 +55,13 @@ module Spectator
initialize(results, runtime)
end
# Yields each result in turn.
def each
@results.each do |result|
yield result
end
end
# Number of examples.
def example_count
@results.size