Class: Rcov::FailureReport

Inherits:
TextSummary show all
Defined in:
lib/rcov/formatters/failure_report.rb

Overview

:nodoc:

Constant Summary

Constant Summary

Constants inherited from BaseFormatter

BaseFormatter::DEFAULT_OPTS, BaseFormatter::RCOV_IGNORE_REGEXPS

Instance Method Summary (collapse)

Methods inherited from TextSummary

#summary

Methods inherited from BaseFormatter

#add_file, #code_coverage, #each_file_pair_sorted, #initialize, #mangle_filename, #normalize_filename, #num_code_lines, #num_lines, #sorted_file_pairs, #total_coverage

Constructor Details

This class inherits a constructor from Rcov::BaseFormatter

Instance Method Details

- (Object) execute



3
4
5
6
7
8
9
10
11
12
13
# File 'lib/rcov/formatters/failure_report.rb', line 3

def execute
  puts summary
  coverage = code_coverage * 100
  if coverage < @failure_threshold
    puts "You failed to satisfy the coverage threshold of #{@failure_threshold}%."
    exit(1)
  end
  if (coverage - @failure_threshold) > 3
    puts "Your coverage is close to your threshold of #{@failure_threshold}. Please increase it."
  end
end