Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/spring/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion test/support/acceptance_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down