Class: SimpleCov::RSpec::UncoveredReport Private

Inherits:
Object
  • Object
show all
Defined in:
lib/simplecov-rspec/uncovered_report.rb

Overview

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.

Formats the "uncovered lines/branches/methods" report printed after a run: either a full listing of every uncovered item, or a per-criterion count with a hint on how to see the details.

Constant Summary collapse

CRITERION_LABELS =

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.

Maps a coverage criterion to its [singular, plural] noun, for report formatting

{
  line: %w[line lines],
  branch: %w[branch branches],
  method: %w[method methods]
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(result:, criteria:, detail:, detail_env_var:) ⇒ UncoveredReport

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.

Build a report for the given result, criteria, and detail level

Examples:

UncoveredReport.new(result: SimpleCov.result, criteria: [:line], detail: true, detail_env_var: 'X')

Parameters:

  • result (SimpleCov::Result)

    the SimpleCov result to report on

  • criteria (Array<Symbol>)

    which criteria (:line, :branch, :method) to report

  • detail (Boolean)

    list individual items, or just a count per criterion

  • detail_env_var (String)

    the ENV var name to suggest for switching to detail



27
28
29
30
31
32
# File 'lib/simplecov-rspec/uncovered_report.rb', line 27

def initialize(result:, criteria:, detail:, detail_env_var:)
  @result = result
  @criteria = criteria
  @detail = detail
  @detail_env_var = detail_env_var
end

Instance Method Details

#to_sString

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.

The formatted report text, or an empty string if there is nothing to report

Returns:

  • (String)


36
# File 'lib/simplecov-rspec/uncovered_report.rb', line 36

def to_s = detail ? detailed_text : summary_text