Class: SimpleCov::Configuration::CoverageCriterion
- Inherits:
-
Object
- Object
- SimpleCov::Configuration::CoverageCriterion
- Defined in:
- lib/simplecov/configuration/coverage.rb,
sig/simplecov.rbs
Overview
Receiver for a coverage <criterion> do ... end block. Each verb
writes a threshold for the single criterion the block configures,
so values are always plain percentages.
Instance Method Summary collapse
-
#exact(percent) ⇒ void
Pin coverage to an exact figure (sets both minimum and maximum).
-
#initialize(config, criterion) ⇒ CoverageCriterion
constructor
A new instance of CoverageCriterion.
-
#maximum(percent) ⇒ void
Overall maximum: fails the build if coverage rises above it.
-
#maximum_drop(percent) ⇒ void
Maximum allowed drop between runs (0 refuses any drop).
-
#minimum(percent) ⇒ void
Overall (suite-wide) minimum for this criterion.
-
#minimum_per_file(percent, only: nil) ⇒ void
Per-file minimum.
-
#minimum_per_group(percent, only:) ⇒ void
Per-group minimum for the named group (defined via
group). -
#primary ⇒ void
Make this criterion the report's primary (leading) criterion.
Constructor Details
#initialize(config, criterion) ⇒ CoverageCriterion
Returns a new instance of CoverageCriterion.
128 129 130 131 |
# File 'lib/simplecov/configuration/coverage.rb', line 128 def initialize(config, criterion) @config = config @criterion = criterion end |
Instance Method Details
#exact(percent) ⇒ void
This method returns an undefined value.
Pin coverage to an exact figure (sets both minimum and maximum).
145 146 147 148 |
# File 'lib/simplecov/configuration/coverage.rb', line 145 def exact(percent) minimum(percent) maximum(percent) end |
#maximum(percent) ⇒ void
This method returns an undefined value.
Overall maximum: fails the build if coverage rises above it.
140 141 142 |
# File 'lib/simplecov/configuration/coverage.rb', line 140 def maximum(percent) @config.send(:store_overall_threshold, :maximum_coverage, @criterion, percent) end |
#maximum_drop(percent) ⇒ void
This method returns an undefined value.
Maximum allowed drop between runs (0 refuses any drop).
151 152 153 |
# File 'lib/simplecov/configuration/coverage.rb', line 151 def maximum_drop(percent) @config.send(:store_overall_threshold, :maximum_coverage_drop, @criterion, percent) end |
#minimum(percent) ⇒ void
This method returns an undefined value.
Overall (suite-wide) minimum for this criterion.
134 135 136 |
# File 'lib/simplecov/configuration/coverage.rb', line 134 def minimum(percent) @config.send(:store_overall_threshold, :minimum_coverage, @criterion, percent) end |
#minimum_per_file(percent, only: nil) ⇒ void
This method returns an undefined value.
Per-file minimum. With no only:, the default for every file;
with only: (String path or Regexp), an override for matches.
158 159 160 |
# File 'lib/simplecov/configuration/coverage.rb', line 158 def minimum_per_file(percent, only: nil) @config.send(:store_minimum_per_file, @criterion, percent, only) end |
#minimum_per_group(percent, only:) ⇒ void
This method returns an undefined value.
Per-group minimum for the named group (defined via group).
163 164 165 |
# File 'lib/simplecov/configuration/coverage.rb', line 163 def minimum_per_group(percent, only:) @config.send(:store_minimum_per_group, @criterion, percent, only) end |
#primary ⇒ void
This method returns an undefined value.
Make this criterion the report's primary (leading) criterion.
168 169 170 171 172 |
# File 'lib/simplecov/configuration/coverage.rb', line 168 def primary # @criterion is Symbol-wide because this receiver is also built for # :eval; primary_coverage validates at runtime. @config.primary_coverage(_ = @criterion) end |