Created
December 17, 2015 21:19
-
-
Save sbleon/3726197109eda6e7fd82 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Place all this at the beginning of your spec_helper.rb to avoid sending | |
# incorrect coverage data to Code Climate. | |
require 'codeclimate-test-reporter' | |
SimpleCov.start 'rails' do | |
# We always want to run the HTML coverage formatter. | |
formatters = [ SimpleCov::Formatter::HTMLFormatter ] | |
# Code Climate records the first coverage data it is sent for any single | |
# commit, and then ignores future reports. If you're running a single spec, | |
# this will result in the reporting of erroneously low test coverage. | |
# So, only send them coverage data if all specs are being run together. | |
running_all_specs = !ARGV.last.match(/_spec\.rb/) | |
if running_all_specs | |
formatters << CodeClimate::TestReporter::Formatter | |
end | |
formatter SimpleCov::Formatter::MultiFormatter.new(formatters) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment