From 647e0b6b24c94b2272b3f006fff633c20ca058e8 Mon Sep 17 00:00:00 2001 From: Samuelfaure Date: Tue, 27 Aug 2024 09:36:18 +0700 Subject: [PATCH] Moving coverage config to correct place --- spec/rails_helper.rb | 22 ++++++++++++++++++++++ spec/spec_helper.rb | 21 --------------------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 9e95b44b7..a88c0ff25 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,4 +1,26 @@ +# Configuration for simplecov +# Test coverage options (activated only if rspec is run without arguments) +if ARGV.grep(/spec\.rb/).empty? || ENV['CI'] || ENV['COVERAGE'] + require 'simplecov' + require 'simplecov-console' + + SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new( + [ + SimpleCov::Formatter::HTMLFormatter, + SimpleCov::Formatter::Console + ] + ) + + SimpleCov.start 'rails' do + add_filter 'app/jobs/application_job.rb' + add_filter 'app/mailers/application_mailer.rb' + add_filter 'lib/tasks/' + add_filter 'lib/mailer_previews/' + end +end + ENV['RAILS_ENV'] ||= 'test' + require File.expand_path('../config/environment', __dir__) # This file is copied to spec/ when you run 'rails generate rspec:install' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 8861bb266..07e1de283 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -12,27 +12,6 @@ # the additional setup, and require it from the spec files that actually need # it. -# Configuration for simplecov -# Test coverage options (activated only if rspec is run without arguments) -if ARGV.grep(/spec\.rb/).empty? || ENV['CI'] || ENV['COVERAGE'] - require 'simplecov' - require 'simplecov-console' - - SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new( - [ - SimpleCov::Formatter::HTMLFormatter, - SimpleCov::Formatter::Console - ] - ) - - SimpleCov.start 'rails' do - add_filter 'app/jobs/application_job.rb' - add_filter 'app/mailers/application_mailer.rb' - add_filter 'lib/tasks/' - add_filter 'lib/mailer_previews/' - end -end - require 'rspec/retry' require 'webmock/rspec' require 'pundit/rspec'