mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Add #failed? method to Report
This commit is contained in:
parent
dbffad837d
commit
e92b1dc466
2 changed files with 21 additions and 0 deletions
|
@ -71,6 +71,22 @@ describe Spectator::Report do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#failed?" do
|
||||||
|
context "with a failed test suite" do
|
||||||
|
it "is true" do
|
||||||
|
report = new_report(5, 4, 3, 2)
|
||||||
|
report.failed?.should be_true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "with a passing test suite" do
|
||||||
|
it "is false" do
|
||||||
|
report = new_report(5, 0, 0, 0)
|
||||||
|
report.failed?.should be_false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "#failures" do
|
describe "#failures" 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) }
|
||||||
|
|
|
@ -41,6 +41,11 @@ module Spectator
|
||||||
@results.size
|
@results.size
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Indicates whether the test suite failed.
|
||||||
|
def failed?
|
||||||
|
failed_count > 0
|
||||||
|
end
|
||||||
|
|
||||||
# Returns a set of results for all failed examples.
|
# Returns a set of results for all failed examples.
|
||||||
def failures
|
def failures
|
||||||
@results.each.compact_map(&.as?(FailedResult))
|
@results.each.compact_map(&.as?(FailedResult))
|
||||||
|
|
Loading…
Reference in a new issue