Class: SimpleCov::ExitCodes::MaximumCoverageDropCheck

Inherits:
Object
  • Object
show all
Defined in:
lib/simplecov/exit_codes/maximum_coverage_drop_check.rb

Overview

Fails when any coverage criterion has dropped by more than the configured maximum since the last recorded run.

Instance Method Summary collapse

Constructor Details

#initialize(result, maximum_coverage_drop) ⇒ MaximumCoverageDropCheck

Returns a new instance of MaximumCoverageDropCheck.



8
9
10
11
# File 'lib/simplecov/exit_codes/maximum_coverage_drop_check.rb', line 8

def initialize(result, maximum_coverage_drop)
  @result = result
  @maximum_coverage_drop = maximum_coverage_drop
end

Instance Method Details

#exit_codeObject



21
22
23
# File 'lib/simplecov/exit_codes/maximum_coverage_drop_check.rb', line 21

def exit_code
  SimpleCov::ExitCodes::MAXIMUM_COVERAGE_DROP
end

#failing?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/simplecov/exit_codes/maximum_coverage_drop_check.rb', line 13

def failing?
  violations.any?
end

#reportObject



17
18
19
# File 'lib/simplecov/exit_codes/maximum_coverage_drop_check.rb', line 17

def report
  violations.each { |violation| warn SimpleCov::Color.colorize(message_for(violation), :red) }
end