mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Rename methods for clarity
This commit is contained in:
parent
6f08101828
commit
8c5760e8dd
2 changed files with 10 additions and 13 deletions
|
@ -79,10 +79,10 @@ module Spectator::Formatters
|
||||||
end
|
end
|
||||||
|
|
||||||
private def result_string(report)
|
private def result_string(report)
|
||||||
examples = report.examples
|
examples = report.example_count
|
||||||
failures = report.failed_examples
|
failures = report.failed_count
|
||||||
errors = report.errored_examples
|
errors = report.error_count
|
||||||
pending = report.pending_examples
|
pending = report.pending_count
|
||||||
string = "#{examples} examples, #{failures} failures, #{errors} errors, #{pending} pending"
|
string = "#{examples} examples, #{failures} failures, #{errors} errors, #{pending} pending"
|
||||||
if failures > 0 || errors > 0
|
if failures > 0 || errors > 0
|
||||||
string.colorize(FAILURE_COLOR)
|
string.colorize(FAILURE_COLOR)
|
||||||
|
|
|
@ -5,27 +5,24 @@ module Spectator
|
||||||
# This includes examples, hooks, and framework processes.
|
# This includes examples, hooks, and framework processes.
|
||||||
getter runtime : Time::Span
|
getter runtime : Time::Span
|
||||||
|
|
||||||
@results : Array(Result)
|
|
||||||
|
|
||||||
# Creates the report.
|
# Creates the report.
|
||||||
# The `results` are from running the examples in the test suite.
|
# The `results` are from running the examples in the test suite.
|
||||||
# The `runtime` is the total time it took to execute the suite.
|
# The `runtime` is the total time it took to execute the suite.
|
||||||
def initialize(results : Enumerable(Result), @runtime)
|
def initialize(@results : Array(Result), @runtime)
|
||||||
@results = results.to_a
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Number of examples.
|
# Number of examples.
|
||||||
def examples
|
def example_count
|
||||||
@results.size
|
@results.size
|
||||||
end
|
end
|
||||||
|
|
||||||
# Number of passing examples.
|
# Number of passing examples.
|
||||||
def successful_examples
|
def successful_count
|
||||||
@results.count(&.successful?)
|
@results.count(&.successful?)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Number of failing examples (includes errors).
|
# Number of failing examples (includes errors).
|
||||||
def failed_examples
|
def failed_count
|
||||||
@results.count(&.failed?)
|
@results.count(&.failed?)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -35,7 +32,7 @@ module Spectator
|
||||||
end
|
end
|
||||||
|
|
||||||
# Number of examples that had errors.
|
# Number of examples that had errors.
|
||||||
def errored_examples
|
def error_count
|
||||||
@results.count(&.errored?)
|
@results.count(&.errored?)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -45,7 +42,7 @@ module Spectator
|
||||||
end
|
end
|
||||||
|
|
||||||
# Number of pending examples.
|
# Number of pending examples.
|
||||||
def pending_examples
|
def pending_count
|
||||||
@results.count(&.pending?)
|
@results.count(&.pending?)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue