diff --git a/app/models/site.rb b/app/models/site.rb index 8b6df669974..f04b25bd766 100644 --- a/app/models/site.rb +++ b/app/models/site.rb @@ -5,7 +5,11 @@ class Site include ActiveModel::Serialization cattr_accessor :preloaded_category_custom_fields - self.preloaded_category_custom_fields = Set.new + + def self.reset_preloaded_category_custom_fields + self.preloaded_category_custom_fields = Set.new + end + reset_preloaded_category_custom_fields ## # Sometimes plugins need to have additional data or options available diff --git a/spec/models/site_spec.rb b/spec/models/site_spec.rb index 213fa774cd6..1cfeac59dc8 100644 --- a/spec/models/site_spec.rb +++ b/spec/models/site_spec.rb @@ -133,7 +133,7 @@ describe Site do expect(categories.last[:custom_fields]["enable_marketplace"]).to eq('f') ensure - Site.preloaded_category_custom_fields.clear + Site.reset_preloaded_category_custom_fields end it 'sets the can_edit field for categories correctly' do diff --git a/spec/requests/api/site_spec.rb b/spec/requests/api/site_spec.rb index 9d026b5dfbb..ec513be52d9 100644 --- a/spec/requests/api/site_spec.rb +++ b/spec/requests/api/site_spec.rb @@ -34,7 +34,7 @@ describe 'site' do let(:expected_request_schema) { expected_request_schema } end ensure - Site.preloaded_category_custom_fields = Set.new + Site.reset_preloaded_category_custom_fields end end end diff --git a/spec/serializers/site_serializer_spec.rb b/spec/serializers/site_serializer_spec.rb index 6ee0d5968ec..6db717a38eb 100644 --- a/spec/serializers/site_serializer_spec.rb +++ b/spec/serializers/site_serializer_spec.rb @@ -25,7 +25,7 @@ describe SiteSerializer do expect(c1[:custom_fields]["enable_marketplace"]).to eq("t") ensure - Site.preloaded_category_custom_fields.clear + Site.reset_preloaded_category_custom_fields end it "includes category tags" do