mirror of
https://github.com/discourse/discourse.git
synced 2026-08-07 03:35:32 -05:00
DEV: Fix flaky test in spec/lib/svg_sprite/svg_sprite_spec.rb (#35673)
We should clean up at the end of each test instead of at the start to ensure that there aren't any side effects. In this particular case, `SvgSprite.expire_cache` calls `DistributedCache#clear` but the cache is only cleared at the end of a transaction. If we clear the cache in a `before` hook, the cache isn't actually cleared until the existing transaction for the test has ended.
This commit is contained in:
@@ -3,10 +3,11 @@
|
||||
RSpec.describe SvgSprite do
|
||||
fab!(:theme)
|
||||
|
||||
before do
|
||||
before { allow(Rails.env).to receive(:test?).and_return(false) }
|
||||
|
||||
after do
|
||||
SvgSprite.clear_plugin_svg_sprite_cache!
|
||||
SvgSprite.expire_cache
|
||||
allow(Rails.env).to receive(:test?).and_return(false)
|
||||
end
|
||||
|
||||
it "can generate a bundle" do
|
||||
|
||||
Reference in New Issue
Block a user