diff --git a/app/controllers/stylesheets_controller.rb b/app/controllers/stylesheets_controller.rb index fbcef46462c..ee78f307650 100644 --- a/app/controllers/stylesheets_controller.rb +++ b/app/controllers/stylesheets_controller.rb @@ -53,7 +53,7 @@ class StylesheetsController < ApplicationController # Security note, safe due to route constraint underscore_digest = digest ? "_" + digest : "" - cache_path = "#{Rails.root}/#{Stylesheet::Manager::CACHE_PATH}" + cache_path = Stylesheet::Manager.cache_fullpath location = "#{cache_path}/#{target}#{underscore_digest}#{extension}" stylesheet_time = query.pluck_first(:created_at) diff --git a/lib/stylesheet/manager.rb b/lib/stylesheet/manager.rb index 20e05771917..3cb2254e7bc 100644 --- a/lib/stylesheet/manager.rb +++ b/lib/stylesheet/manager.rb @@ -135,7 +135,9 @@ class Stylesheet::Manager end def self.cache_fullpath - "#{Rails.root}/#{CACHE_PATH}" + path = "#{Rails.root}/#{CACHE_PATH}" + return path if !Rails.env.test? + File.join(path, "test_#{ENV['TEST_ENV_NUMBER'].presence || '0'}") end attr_reader :theme_ids