A platform for community discussion. Free, open, simple.
DEV: Clean up state leak in `Site` tests.
Alan Guo Xiang Tan3b32b6bc136d
diff --git a/spec/models/site_spec.rb b/spec/models/site_spec.rbindex 8ea6e9bb28b..3e2e0c2e81b 100644--- a/spec/models/site_spec.rb+++ b/spec/models/site_spec.rb@@ -3,6 +3,9 @@require 'rails_helper'describe Site do+ after do+ Site.clear_cache+ enddef expect_correct_themes(guardian)json = Site.json_for(guardian)@@ -63,10 +66,6 @@ describe Site dofab!(:user) { Fabricate(:user) }fab!(:guardian) { Guardian.new(user) }- after do- Site.clear_cache- end-it "omits read restricted categories" doexpect(Site.new(guardian).categories.map(&:id)).to contain_exactly(SiteSetting.uncategorized_category_id, category.id@@ -136,6 +135,8 @@ describe Site docategories = Site.new(Guardian.new).categoriesexpect(categories.last[:custom_fields]["enable_marketplace"]).to eq('f')+ ensure+ Site.preloaded_category_custom_fields.clearendenddiff --git a/spec/serializers/site_serializer_spec.rb b/spec/serializers/site_serializer_spec.rbindex 482905de36a..8dca84a7e04 100644--- a/spec/serializers/site_serializer_spec.rb+++ b/spec/serializers/site_serializer_spec.rb@@ -26,6 +26,8 @@ describe SiteSerializer doc1 = serialized[:categories].find { |c| c[:id] == category.id }expect(c1[:custom_fields]["enable_marketplace"]).to eq("t")+ ensure+ Site.preloaded_category_custom_fields.clearendit "includes category tags" do