From 1bd426d300ad80a1edd36e04013aaa51c52d3491 Mon Sep 17 00:00:00 2001 From: Justin Coyne Date: Tue, 12 Dec 2017 09:24:32 -0600 Subject: [PATCH] Don't calculate coverage on the generated test app --- spec/spec_helper.rb | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ca141c2..4b08f67 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,8 +1,23 @@ # frozen_string_literal: true ENV['RAILS_ENV'] ||= 'test' -require 'coveralls' -Coveralls.wear! +def coverage_needed? + ENV['COVERAGE'] || ENV['TRAVIS'] +end + +if coverage_needed? + require 'simplecov' + require 'coveralls' + SimpleCov.root(File.expand_path('../..', __FILE__)) + SimpleCov.formatter = Coveralls::SimpleCov::Formatter + SimpleCov.start('rails') do + add_filter '/.internal_test_app' + add_filter '/lib/generators' + add_filter '/spec' + end + SimpleCov.command_name 'spec' +end + require 'engine_cart' EngineCart.load_application!