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.
125 126 127 128 |
# File 'lib/simplecov/configuration/coverage.rb', line 125 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).
142 143 144 145 |
# File 'lib/simplecov/configuration/coverage.rb', line 142 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.
137 138 139 |
# File 'lib/simplecov/configuration/coverage.rb', line 137 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).
148 149 150 |
# File 'lib/simplecov/configuration/coverage.rb', line 148 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.
131 132 133 |
# File 'lib/simplecov/configuration/coverage.rb', line 131 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.
155 156 157 |
# File 'lib/simplecov/configuration/coverage.rb', line 155 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).
160 161 162 |
# File 'lib/simplecov/configuration/coverage.rb', line 160 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.
165 166 167 168 169 |
# File 'lib/simplecov/configuration/coverage.rb', line 165 def primary # @criterion is Symbol-wide because this receiver is also built for # :eval; primary_coverage validates at runtime. @config.primary_coverage(_ = @criterion) end |