Class: SimpleCov::ExitCodes::MaximumCoverageDropCheck
- Inherits:
-
Object
- Object
- SimpleCov::ExitCodes::MaximumCoverageDropCheck
- Defined in:
- lib/simplecov/exit_codes/maximum_coverage_drop_check.rb
Instance Method Summary collapse
- #exit_code ⇒ Object
- #failing? ⇒ Boolean
-
#initialize(result, maximum_coverage_drop) ⇒ MaximumCoverageDropCheck
constructor
A new instance of MaximumCoverageDropCheck.
- #report ⇒ Object
Constructor Details
#initialize(result, maximum_coverage_drop) ⇒ MaximumCoverageDropCheck
Returns a new instance of MaximumCoverageDropCheck.
6 7 8 9 |
# File 'lib/simplecov/exit_codes/maximum_coverage_drop_check.rb', line 6 def initialize(result, maximum_coverage_drop) @result = result @maximum_coverage_drop = maximum_coverage_drop end |
Instance Method Details
#exit_code ⇒ Object
28 29 30 |
# File 'lib/simplecov/exit_codes/maximum_coverage_drop_check.rb', line 28 def exit_code SimpleCov::ExitCodes::MAXIMUM_COVERAGE_DROP end |
#failing? ⇒ Boolean
11 12 13 14 15 |
# File 'lib/simplecov/exit_codes/maximum_coverage_drop_check.rb', line 11 def failing? return false unless maximum_coverage_drop && last_run coverage_drop_violations.any? end |
#report ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/simplecov/exit_codes/maximum_coverage_drop_check.rb', line 17 def report coverage_drop_violations.each do |violation| $stderr.printf( "%<criterion>s coverage has dropped by %<drop_percent>.2f%% since the last time (maximum allowed: %<max_drop>.2f%%).\n", criterion: violation[:criterion].capitalize, drop_percent: SimpleCov.round_coverage(violation[:drop_percent]), max_drop: violation[:max_drop] ) end end |