Remove config.public_file_server.enabled from generators

Remove the option `config.public_file_server.enabled` from the generators for all environments, as the value is the same in all environments.

Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>
This commit is contained in:
Adrian Hirt 2023-10-30 14:17:19 +01:00 committed by Jonathan Hefner
parent 2c2ccec1c0
commit f0a03bd899
7 changed files with 23 additions and 5 deletions

@ -18,7 +18,6 @@
config.eager_load = ENV["CI"].present?
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
"Cache-Control" => "public, max-age=#{1.hour.to_i}"
}

@ -18,7 +18,6 @@
config.eager_load = ENV["CI"].present?
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
"Cache-Control" => "public, max-age=#{1.hour.to_i}"
}

@ -18,7 +18,6 @@
config.eager_load = ENV["CI"].present?
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
"Cache-Control" => "public, max-age=#{1.hour.to_i}"
}

@ -37,4 +37,9 @@
*Steve Polito*
* Remove the option `config.public_file_server.enabled` from the generators
for all environments, as the value is the same in all environments.
*Adrian Hirt*
Please check [7-1-stable](https://github.com/rails/rails/blob/7-1-stable/railties/CHANGELOG.md) for previous changes.

@ -18,7 +18,6 @@ Rails.application.configure do
config.eager_load = ENV["CI"].present?
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
"Cache-Control" => "public, max-age=#{1.hour.to_i}"
}

@ -250,7 +250,6 @@ class User < ActiveRecord::Base; raise 'should not be reached'; end
test "assets do not require any assets group gem when manifest file is present" do
app_file "app/assets/javascripts/application.js", "alert();"
app_file "app/assets/config/manifest.js", "//= link application.js"
add_to_env_config "production", "config.public_file_server.enabled = true"
precompile! RAILS_ENV: "production"

@ -695,6 +695,24 @@ def assert_utf8
assert_equal Pathname.new(app_path).join("somewhere"), Rails.public_path
end
test "In development mode, config.public_file_server.enabled is on by default" do
restore_default_config
with_rails_env "development" do
app "development"
assert app.config.public_file_server.enabled
end
end
test "In test mode, config.public_file_server.enabled is on by default" do
restore_default_config
with_rails_env "test" do
app "test"
assert app.config.public_file_server.enabled
end
end
test "In production mode, config.public_file_server.enabled is on by default" do
restore_default_config