aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2019-04-07 12:30:34 +0200
committerXavier Noria <fxn@hashref.com>2019-04-07 13:05:26 +0200
commit57c7cbb1623c0e8befc58988a34bbb9896fd226a (patch)
tree56160343a026cd0fc0bf7e64c988b6937c224aed /railties
parentc9e4c848eeeb8999b778fa1ae52185ca5537fffe (diff)
downloadrails-57c7cbb1623c0e8befc58988a34bbb9896fd226a.tar.gz
rails-57c7cbb1623c0e8befc58988a34bbb9896fd226a.tar.bz2
rails-57c7cbb1623c0e8befc58988a34bbb9896fd226a.zip
depend on Zeitwerk 2
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/application/finisher.rb2
-rw-r--r--railties/test/application/zeitwerk_integration_test.rb14
2 files changed, 15 insertions, 1 deletions
diff --git a/railties/lib/rails/application/finisher.rb b/railties/lib/rails/application/finisher.rb
index 8d2c13d2a8..1cf44a480c 100644
--- a/railties/lib/rails/application/finisher.rb
+++ b/railties/lib/rails/application/finisher.rb
@@ -24,7 +24,7 @@ module Rails
initializer :let_zeitwerk_take_over do
if config.autoloader == :zeitwerk
require "active_support/dependencies/zeitwerk_integration"
- ActiveSupport::Dependencies::ZeitwerkIntegration.take_over
+ ActiveSupport::Dependencies::ZeitwerkIntegration.take_over(enable_reloading: !config.cache_classes)
end
end
diff --git a/railties/test/application/zeitwerk_integration_test.rb b/railties/test/application/zeitwerk_integration_test.rb
index dc6db429a9..a9da060347 100644
--- a/railties/test/application/zeitwerk_integration_test.rb
+++ b/railties/test/application/zeitwerk_integration_test.rb
@@ -131,6 +131,20 @@ class ZeitwerkIntegrationTest < ActiveSupport::TestCase
assert $zeitwerk_integration_test_post
end
+ test "reloading is enabled if config.cache_classes is false" do
+ boot
+
+ assert Rails.autoloaders.main.reloading_enabled?
+ assert_not Rails.autoloaders.once.reloading_enabled?
+ end
+
+ test "reloading is disabled if config.cache_classes is true" do
+ boot("production")
+
+ assert_not Rails.autoloaders.main.reloading_enabled?
+ assert_not Rails.autoloaders.once.reloading_enabled?
+ end
+
test "eager loading loads code in engines" do
$test_blog_engine_eager_loaded = false