From 8c57ccdaf9e02ba2233c4116a3481d3d85639df9 Mon Sep 17 00:00:00 2001 From: Pau Perez Date: Mon, 15 Mar 2021 11:48:28 +0100 Subject: [PATCH] Replace assets test config with public_file_server This fixes the following deprecation warnings ``` DEPRECATION WARNING: `config.serve_static_files` is deprecated and will be removed in Rails 5.1. Please use `config.public_file_server.enabled = true` instead. (called from block in at /home/runner/work/openfoodnetwork/openfoodnetwork/config/environments/test.rb:13) DEPRECATION WARNING: `config.static_cache_control` is deprecated and will be removed in Rails 5.1. Please use `config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' }` instead. (called from block in at /home/runner/work/openfoodnetwork/openfoodnetwork/config/environments/test.rb:14) ``` --- config/environments/production.rb | 2 +- config/environments/staging.rb | 2 +- config/environments/test.rb | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 695f61a0a18..826a4de6165 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -11,7 +11,7 @@ config.action_controller.perform_caching = true # Disable Rails's static asset server (Apache or nginx will already do this) - config.serve_static_files = false + config.public_file_server.enabled = false # Compress JavaScripts and CSS config.assets.compress = true diff --git a/config/environments/staging.rb b/config/environments/staging.rb index 695f61a0a18..826a4de6165 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -11,7 +11,7 @@ config.action_controller.perform_caching = true # Disable Rails's static asset server (Apache or nginx will already do this) - config.serve_static_files = false + config.public_file_server.enabled = false # Compress JavaScripts and CSS config.assets.compress = true diff --git a/config/environments/test.rb b/config/environments/test.rb index 665525bb132..dd68bc04593 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -10,8 +10,8 @@ config.eager_load = false # Configure static asset server for tests with Cache-Control for performance - config.serve_static_files = true - config.static_cache_control = "public, max-age=3600" + config.public_file_server.enabled = true + config.public_file_server.headers = { 'Cache-Control' => 'public, max-age=3600' } # Separate cache stores when running in parallel config.cache_store = :file_store, Rails.root.join("tmp", "cache", "paralleltests#{ENV['TEST_ENV_NUMBER']}")