diff --git a/lib/spring/application.rb b/lib/spring/application.rb index 6fdbbb3a..d0eb3bf2 100644 --- a/lib/spring/application.rb +++ b/lib/spring/application.rb @@ -102,9 +102,14 @@ def preload Rails::Application.initializer :ensure_reloading_is_enabled, group: :all do if Rails.application.config.cache_classes + config_name, set_to = if Rails.application.config.respond_to?(:enable_reloading=) + ["enable_reloading", "true"] + else + ["cache_classes", "false"] + end raise <<-MSG.strip_heredoc Spring reloads, and therefore needs the application to have reloading enabled. - Please, set config.cache_classes to false in config/environments/#{Rails.env}.rb. + Please, set config.#{config_name} to #{set_to} in config/environments/#{Rails.env}.rb. MSG end end diff --git a/test/support/acceptance_test.rb b/test/support/acceptance_test.rb index 1aee4ef1..48a4c07a 100644 --- a/test/support/acceptance_test.rb +++ b/test/support/acceptance_test.rb @@ -144,7 +144,12 @@ def without_gem(name) end File.write(config_path, config) - assert_failure "bin/rails runner 1", stderr: "Please, set config.cache_classes to false" + expected_error = Regexp.union( + "Please, set config.enable_reloading to true", + "Please, set config.cache_classes to false" + ) + + assert_failure "bin/rails runner 1", stderr: expected_error end test "test changes are picked up" do