Move flatware setup into rails_helper (#38944)

This commit is contained in:
Matt Jankowski 2026-05-12 09:12:49 -04:00 committed by GitHub
parent 735a00d741
commit a547dfff37
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 13 deletions

View File

@ -163,7 +163,7 @@ jobs:
rspec-persistence-main
rspec-persistence
- run: bin/flatware rspec -r ./spec/flatware_helper.rb
- run: bin/flatware rspec
- name: Upload coverage reports to Codecov
if: matrix.ruby-version == '.ruby-version'

View File

@ -1,12 +0,0 @@
# frozen_string_literal: true
if defined?(Flatware)
Flatware.configure do |config|
config.after_fork do |test_env_number|
if ENV.fetch('COVERAGE', false)
require 'simplecov'
SimpleCov.at_fork.call(test_env_number) # Combines parallel coverage results
end
end
end
end

View File

@ -6,6 +6,9 @@ if ENV.fetch('COVERAGE', false)
require 'simplecov'
SimpleCov.start 'rails' do
# During parallel runs, ensure unique names for post-run merge
command_name "job-#{ENV['TEST_ENV_NUMBER']}" if ENV['TEST_ENV_NUMBER']
if ENV['CI']
require 'simplecov-lcov'
formatter SimpleCov::Formatter::LcovFormatter
@ -26,6 +29,12 @@ if ENV.fetch('COVERAGE', false)
add_group 'Services', 'app/services'
add_group 'Validators', 'app/validators'
end
if defined?(Flatware)
Flatware.configure do |config|
config.after_fork { |test| SimpleCov.at_fork.call(test) } # Combines parallel coverage results
end
end
end
# This needs to be defined before Rails is initialized