Class: SimpleCov::RSpec
- Inherits:
-
Object
- Object
- SimpleCov::RSpec
- Defined in:
- lib/simplecov-rspec.rb,
lib/simplecov-rspec/uncovered_report.rb,
lib/simplecov-rspec/list_uncovered_option.rb
Overview
Configure SimpleCov to enforce coverage thresholds for RSpec, on top of what SimpleCov itself already provides.
SimpleCov (>= 1.0) can already enforce minimum_coverage for line, branch, and
method coverage, and will exit with a non-zero status when a threshold is missed.
This gem layers three things SimpleCov doesn't do on its own:
- Suppresses coverage failures when RSpec is run in dry-run mode (e.g. from an IDE).
- Lists (or summarizes) the individual uncovered lines, branches, and methods.
- Lets all of the above be overridden from the environment, for CI.
Simply add the line SimpleCov::RSpec.start in place of SimpleCov.start in
the project's spec_helper.rb. This line must appear before the project is
required.
Defined Under Namespace
Modules: ListUncoveredOption Classes: UncoveredReport
Instance Attribute Summary collapse
-
#env ⇒ Hash
readonly
private
The environment variables consulted for overrides.
-
#simplecov_module ⇒ Module
readonly
private
The SimpleCov module being configured.
-
#start_config_block ⇒ Proc?
readonly
private
A configuration block passed through to
SimpleCov.start.
Class Method Summary collapse
-
.start(minimum_coverage: { line: 100 }, fail_on_low_coverage: true, list_uncovered: false, list_uncovered_detail: true, rspec_dry_run: ::RSpec.configuration.dry_run?, env: ENV, &start_config_block) ⇒ Void
Configure and start SimpleCov for RSpec.
Instance Attribute Details
#env ⇒ Hash (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The environment variables consulted for overrides
|
|
# File 'lib/simplecov-rspec.rb', line 42
|
#simplecov_module ⇒ Module (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The SimpleCov module being configured
|
|
# File 'lib/simplecov-rspec.rb', line 42
|
#start_config_block ⇒ Proc? (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
A configuration block passed through to SimpleCov.start
|
|
# File 'lib/simplecov-rspec.rb', line 42
|
Class Method Details
.start(minimum_coverage: { line: 100 }, fail_on_low_coverage: true, list_uncovered: false, list_uncovered_detail: true, rspec_dry_run: ::RSpec.configuration.dry_run?, env: ENV, &start_config_block) ⇒ Void
Configure and start SimpleCov for RSpec
135 |
# File 'lib/simplecov-rspec.rb', line 135 def self.start(...) = new(...).send(:start) |