Skip to content

Commit

Permalink
Remove config.public_file_server.enabled from generators
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Adrian-Hirt and jonathanhefner committed Nov 3, 2023
1 parent 2c2ccec commit f0a03bd
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 5 deletions.
1 change: 0 additions & 1 deletion actionmailbox/test/dummy/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
}
Expand Down
1 change: 0 additions & 1 deletion actiontext/test/dummy/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
}
Expand Down
1 change: 0 additions & 1 deletion activestorage/test/dummy/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
}
Expand Down
5 changes: 5 additions & 0 deletions railties/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
}
Expand Down
1 change: 0 additions & 1 deletion railties/test/application/assets_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
18 changes: 18 additions & 0 deletions railties/test/application/configuration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit f0a03bd

Please sign in to comment.