diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2015-11-03 23:02:00 +0100 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2015-11-03 23:10:55 +0100 |
commit | 748b2f9cb1ff05a8aab068e2fa802e9f12163e30 (patch) | |
tree | 92c1171f8ae5ea2fc597e26a4692e41aeb031128 /railties/test | |
parent | e37b470a6675a05df5a57455a3ac8c1c88ef04d6 (diff) | |
download | rails-748b2f9cb1ff05a8aab068e2fa802e9f12163e30.tar.gz rails-748b2f9cb1ff05a8aab068e2fa802e9f12163e30.tar.bz2 rails-748b2f9cb1ff05a8aab068e2fa802e9f12163e30.zip |
Add enabled flag to the public file server.
As discussed in https://github.com/rails/rails/pull/19135#issuecomment-153385986.
Replaces `serve_static_files` to unify the static options under the `public_file_server` wing.
Deprecates `serve_static_files` accessors, but make them use the newer config internally.
Diffstat (limited to 'railties/test')
-rw-r--r-- | railties/test/application/configuration_test.rb | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index 22b615023d..5f3d1879eb 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -308,37 +308,47 @@ module ApplicationTests assert_equal Pathname.new(app_path).join("somewhere"), Rails.public_path end - test "In production mode, config.serve_static_files is off by default" do + test "In production mode, config.public_file_server.enabled is off by default" do restore_default_config with_rails_env "production" do app 'production' - assert_not app.config.serve_static_files + assert_not app.config.public_file_server.enabled end end - test "In production mode, config.serve_static_files is enabled when RAILS_SERVE_STATIC_FILES is set" do + test "In production mode, config.public_file_server.enabled is enabled when RAILS_SERVE_STATIC_FILES is set" do restore_default_config with_rails_env "production" do switch_env "RAILS_SERVE_STATIC_FILES", "1" do app 'production' - assert app.config.serve_static_files + assert app.config.public_file_server.enabled end end end - test "In production mode, config.serve_static_files is disabled when RAILS_SERVE_STATIC_FILES is blank" do + test "In production mode, config.public_file_server.enabled is disabled when RAILS_SERVE_STATIC_FILES is blank" do restore_default_config with_rails_env "production" do switch_env "RAILS_SERVE_STATIC_FILES", " " do app 'production' - assert_not app.config.serve_static_files + assert_not app.config.public_file_server.enabled end end end + test "config.serve_static_files is deprecated" do + make_basic_app do |application| + assert_deprecated do + application.config.serve_static_files = true + end + + assert application.config.public_file_server.enabled + end + end + test "config.static_cache_control is deprecated" do make_basic_app do |application| assert_deprecated do |