RSpec::SimpleCov
Creates an after suite hook in RSpec that dynamically creates and injects a new test case that expects the actual code coverage to be at least the lower limit set in Simplecov.
Installation
Add this line to your application's Gemfile:
gem 'rspec-simplecov'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rspec-simplecov
Usage
If you are already using Rspec and SimpleCov you probably have this somewhere
near the top of your spec_helper.rb
:
require 'simplecov'
SimpleCov.minimum_coverage 95
SimpleCov.start
RSpec.configure do |config|
# ...
All you need to do is require and add the initializer line for RSpec::SimpleCov like this:
require 'simplecov'
require 'rspec/simplecov'
SimpleCov.minimum_coverage 95
SimpleCov.start
RSpec::SimpleCov.start
RSpec.configure do |config|
# ...
And you to can enjoy the glory of a failing RSpec suite when your code coverage
drops below SimpleCov.minimum_coverage
:)
Contributing
- Fork it ( https://github.com/[my-github-username]/rspec-simplecov/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request