Configure SimpleCov as recommended by author

The configuration can go into the central .simplecov file and then we
just need to `require` simplecov to start the coverage process. This
also avoids duplicating the config if we want to start simplecov from
the rails server to cover the lines used in by the server in feature
specs.

https://github.com/simplecov-ruby/simplecov#using-simplecov-for-centralized-config
This commit is contained in:
Maikel Linke
2021-03-12 11:08:38 +11:00
parent 3ee54b1bfa
commit 62234c0708
3 changed files with 19 additions and 26 deletions

18
.simplecov Normal file
View File

@@ -0,0 +1,18 @@
#!/bin/env ruby
SimpleCov.start 'rails' do
minimum_coverage 54
add_filter '/bin/'
add_filter '/config/'
add_filter '/jobs/application_job.rb'
add_filter '/schemas/'
add_filter '/lib/generators'
add_filter '/spec/'
add_filter '/vendor/'
add_filter '/public'
add_filter '/swagger'
add_filter '/script'
add_filter '/log'
add_filter '/db'
end

View File

@@ -1,21 +0,0 @@
# frozen_string_literal: true
if ENV["COVERAGE"]
require 'simplecov'
SimpleCov.minimum_coverage 54
SimpleCov.start 'rails' do
add_filter '/bin/'
add_filter '/config/'
add_filter '/jobs/application_job.rb'
add_filter '/schemas/'
add_filter '/lib/generators'
add_filter '/spec/'
add_filter '/vendor/'
add_filter '/public'
add_filter '/swagger'
add_filter '/script'
add_filter '/log'
add_filter '/db'
end
end

View File

@@ -1,9 +1,6 @@
# frozen_string_literal: true
if ENV["COVERAGE"]
require 'simplecov'
SimpleCov.start 'rails'
end
require 'simplecov' if ENV["COVERAGE"]
require 'rubygems'
@@ -24,7 +21,6 @@ require 'rspec/rails'
require 'capybara'
require 'database_cleaner'
require 'rspec/retry'
require 'coverage_helper'
require 'paper_trail/frameworks/rspec'
require 'webdrivers'