From 5d11ee6f067491aacd6d6480038a206f2993fe28 Mon Sep 17 00:00:00 2001 From: Ernesto Tagwerker Date: Mon, 6 Apr 2020 22:07:06 -0400 Subject: [PATCH] Add require for code coverage libraries Make sure we load `simplecov` and `codecov` when we find the right environment variables are present --- spec/spec_helper.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ddcb2a9..aacc643 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -2,6 +2,19 @@ require "bundler/setup" require "database_cleaner-core" require "byebug" +if ENV['COVERAGE'] == 'true' + require "simplecov" + + if ENV['CI'] == 'true' + require 'codecov' + SimpleCov.formatter = SimpleCov::Formatter::Codecov + puts "required codecov" + end + + SimpleCov.start + puts "required simplecov" +end + RSpec.configure do |config| # These two settings work together to allow you to limit a spec run # to individual examples or groups you care about by tagging them with