DEV: Better SimpleCov configuration (#12544)

DEV: Better SimpleCov configuration (#12544)

It makes SimpleCov work with turbo_rspec and uses the default Rails configuration (with some changes) to groups files by their type (models, controllers, etc).

diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index 6286218..d3da629 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -2,7 +2,14 @@
 
 if ENV['COVERAGE']
   require 'simplecov'
-  SimpleCov.start
+  SimpleCov.command_name "#{SimpleCov.command_name} #{ENV['TEST_ENV_NUMBER']}" if ENV['TEST_ENV_NUMBER']
+  SimpleCov.start 'rails' do
+    add_group 'Libraries', /^\/lib\/(?!tasks).*$/
+    add_group 'Scripts', 'script'
+    add_group 'Serializers', 'app/serializers'
+    add_group 'Services', 'app/services'
+    add_group 'Tasks', 'lib/tasks'
+  end
 end
 
 require 'rubygems'

GitHub sha: c89f97aa

This commit appears in #12544 which was approved by eviltrout. It was merged by udan11.