mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Lazy iterate over failures and errors
Return iterator from #failures and #errors methods in Report. Update spec to reflect this.
This commit is contained in:
parent
32a049d973
commit
dc7d5fbe25
2 changed files with 6 additions and 6 deletions
|
@ -75,7 +75,7 @@ describe Spectator::Report do
|
||||||
it "returns the expected results" do
|
it "returns the expected results" do
|
||||||
results = Array.new(5) { new_failure_result.as(Spectator::Result) }
|
results = Array.new(5) { new_failure_result.as(Spectator::Result) }
|
||||||
report = Spectator::Report.new(results, Time::Span.zero)
|
report = Spectator::Report.new(results, Time::Span.zero)
|
||||||
report.failures.should eq(results)
|
report.failures.to_a.should eq(results)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "includes errors" do
|
it "includes errors" do
|
||||||
|
@ -87,7 +87,7 @@ describe Spectator::Report do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
report = Spectator::Report.new(results, Time::Span.zero)
|
report = Spectator::Report.new(results, Time::Span.zero)
|
||||||
report.failures.should eq(results)
|
report.failures.to_a.should eq(results)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ describe Spectator::Report do
|
||||||
it "returns the expected results" do
|
it "returns the expected results" do
|
||||||
results = Array.new(5) { new_failure_result(Spectator::ErroredResult).as(Spectator::Result) }
|
results = Array.new(5) { new_failure_result(Spectator::ErroredResult).as(Spectator::Result) }
|
||||||
report = Spectator::Report.new(results, Time::Span.zero)
|
report = Spectator::Report.new(results, Time::Span.zero)
|
||||||
report.errors.should eq(results)
|
report.errors.to_a.should eq(results)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "does not include failures" do
|
it "does not include failures" do
|
||||||
|
@ -108,7 +108,7 @@ describe Spectator::Report do
|
||||||
end
|
end
|
||||||
report = Spectator::Report.new(results, Time::Span.zero)
|
report = Spectator::Report.new(results, Time::Span.zero)
|
||||||
errors_only = results.select(&.is_a?(Spectator::ErroredResult))
|
errors_only = results.select(&.is_a?(Spectator::ErroredResult))
|
||||||
report.errors.should eq(errors_only)
|
report.errors.to_a.should eq(errors_only)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -38,12 +38,12 @@ module Spectator
|
||||||
|
|
||||||
# Returns a set of results for all failed examples.
|
# Returns a set of results for all failed examples.
|
||||||
def failures
|
def failures
|
||||||
@results.compact_map(&.as?(FailedResult))
|
@results.each.compact_map(&.as?(FailedResult))
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns a set of results for all errored examples.
|
# Returns a set of results for all errored examples.
|
||||||
def errors
|
def errors
|
||||||
@results.compact_map(&.as?(ErroredResult))
|
@results.each.compact_map(&.as?(ErroredResult))
|
||||||
end
|
end
|
||||||
|
|
||||||
# Length of time it took to run just example code.
|
# Length of time it took to run just example code.
|
||||||
|
|
Loading…
Reference in a new issue