Class: Evilution::Reporter::CLI::LineFormatters::ResultLine Private

Inherits:
Object
  • Object
show all
Defined in:
lib/evilution/reporter/cli/line_formatters/result_line.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary collapse

DEFAULT_MIN_SCORE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

0.8

Instance Method Summary collapse

Constructor Details

#initialize(pct: Evilution::Reporter::CLI::Pct.new, min_score: DEFAULT_MIN_SCORE) ⇒ ResultLine

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ResultLine.



9
10
11
12
# File 'lib/evilution/reporter/cli/line_formatters/result_line.rb', line 9

def initialize(pct: Evilution::Reporter::CLI::Pct.new, min_score: DEFAULT_MIN_SCORE)
  @pct = pct
  @min_score = min_score
end

Instance Method Details

#format(summary) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



14
15
16
17
18
19
# File 'lib/evilution/reporter/cli/line_formatters/result_line.rb', line 14

def format(summary)
  pass_fail = summary.success?(min_score: @min_score) ? "PASS" : "FAIL"
  score_pct = @pct.format(summary.score)
  threshold_pct = @pct.format(@min_score)
  "Result: #{pass_fail} (score #{score_pct} #{pass_fail == "PASS" ? ">=" : "<"} #{threshold_pct})"
end