mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 07:23:40 +08:00
DEV: Clean up state leak in Site
tests.
This commit is contained in:
parent
5c3109281d
commit
3b32b6bc13
|
@ -3,6 +3,9 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe Site do
|
||||
after do
|
||||
Site.clear_cache
|
||||
end
|
||||
|
||||
def expect_correct_themes(guardian)
|
||||
json = Site.json_for(guardian)
|
||||
|
@ -63,10 +66,6 @@ describe Site do
|
|||
fab!(:user) { Fabricate(:user) }
|
||||
fab!(:guardian) { Guardian.new(user) }
|
||||
|
||||
after do
|
||||
Site.clear_cache
|
||||
end
|
||||
|
||||
it "omits read restricted categories" do
|
||||
expect(Site.new(guardian).categories.map(&:id)).to contain_exactly(
|
||||
SiteSetting.uncategorized_category_id, category.id
|
||||
|
@ -136,6 +135,8 @@ describe Site do
|
|||
categories = Site.new(Guardian.new).categories
|
||||
|
||||
expect(categories.last[:custom_fields]["enable_marketplace"]).to eq('f')
|
||||
ensure
|
||||
Site.preloaded_category_custom_fields.clear
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -26,6 +26,8 @@ describe SiteSerializer do
|
|||
c1 = serialized[:categories].find { |c| c[:id] == category.id }
|
||||
|
||||
expect(c1[:custom_fields]["enable_marketplace"]).to eq("t")
|
||||
ensure
|
||||
Site.preloaded_category_custom_fields.clear
|
||||
end
|
||||
|
||||
it "includes category tags" do
|
||||
|
|
Loading…
Reference in New Issue
Block a user