Skip to content

Commit 3fc58e5

Browse files
committed
Fix ActiveSupport::TestCase being loaded too early
rails/rails@76966f9 implemented configuration to report assertionless tests. But the configuration causes ActiveSupport::TestCase to be loaded too early in the boot process. It causes issues when other engines define load hooks on :active_support_test_case because they are run immediately. Instead, we should wrap the configuration in a load hook so it gets set at the appropriate time.
1 parent d366a99 commit 3fc58e5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

activesupport/lib/active_support/railtie.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ class Railtie < Rails::Railtie # :nodoc:
125125
elsif k == :use_rfc4122_namespaced_uuids
126126
ActiveSupport.deprecator.warn("config.active_support.use_rfc4122_namespaced_uuids is deprecated and will be removed in Rails 7.2.")
127127
elsif k == :assertionless_tests_behavior
128-
ActiveSupport::TestCase.assertionless_tests_behavior = v
128+
ActiveSupport.on_load(:active_support_test_case) do
129+
ActiveSupport::TestCase.assertionless_tests_behavior = v
130+
end
129131
else
130132
k = "#{k}="
131133
ActiveSupport.public_send(k, v) if ActiveSupport.respond_to? k

0 commit comments

Comments
 (0)