mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
FEATURE: move stylesheet cache out of the uploads directory
This commit is contained in:
24
spec/models/stylesheet_cache_spec.rb
Normal file
24
spec/models/stylesheet_cache_spec.rb
Normal file
@ -0,0 +1,24 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe StylesheetCache do
|
||||
|
||||
describe "add" do
|
||||
it "correctly cycles once MAX_TO_KEEP is hit" do
|
||||
(StylesheetCache::MAX_TO_KEEP + 1).times do |i|
|
||||
StylesheetCache.add(i.to_s, "d" + i.to_s, "c" + i.to_s)
|
||||
end
|
||||
|
||||
expect(StylesheetCache.count).to eq StylesheetCache::MAX_TO_KEEP
|
||||
expect(StylesheetCache.order(:id).first.content).to eq "c1"
|
||||
end
|
||||
|
||||
it "does nothing if digest is set and already exists" do
|
||||
StylesheetCache.add("a", "b", "c")
|
||||
StylesheetCache.add("a", "b", "cc")
|
||||
|
||||
expect(StylesheetCache.count).to eq 1
|
||||
expect(StylesheetCache.first.content).to eq "c"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user