mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 07:11:34 +08:00
DEV: Fix test incorrectly removing stylesheet cache of other processes (#25103)
Why this change? The `can survive cache miss` test in `spec/requests/stylesheets_controller_spec.rb` was failing because the file was not found on disk for the cache to be regenerated. This is because a test in `spec/lib/stylesheet/manager_spec.rb` was removing the entire `tmp/stylesheet-cache` directory which is incorrect because the folder in the test environment further segretates the stylesheet caches based on the process of the test. What does this change do? 1. Introduce `Stylesheet::Manager.rm_cache_folder` method for the test environment to properly clean up the cache folder. 2. Make `Stylesheet::Manager::CACHE_PATH` a private constant since the cache path should be obtained from the `Stylesheet::Manager.cache_fullpath` method.
This commit is contained in:

committed by
GitHub

parent
1a423f3c2d
commit
5530cb574b
@ -886,7 +886,7 @@ RSpec.describe Stylesheet::Manager do
|
||||
|
||||
after do
|
||||
STDERR.unstub(:write)
|
||||
FileUtils.rm_rf("tmp/stylesheet-cache")
|
||||
Stylesheet::Manager.rm_cache_folder
|
||||
end
|
||||
|
||||
it "correctly generates precompiled CSS" do
|
||||
|
Reference in New Issue
Block a user