From 7f8cdea9244760b7f27bcebb86de0121006f0ce3 Mon Sep 17 00:00:00 2001 From: Daniel Waterworth Date: Fri, 20 Sep 2019 13:32:43 +0100 Subject: [PATCH] FIX: Cleanup DiscoursePluginRegistry state after tests that use it This was causing some heisentests --- spec/components/stylesheet/compiler_spec.rb | 1 + spec/components/stylesheet/manager_spec.rb | 2 +- spec/lib/content_security_policy_spec.rb | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/spec/components/stylesheet/compiler_spec.rb b/spec/components/stylesheet/compiler_spec.rb index 7443fbf6263..5191d72e967 100644 --- a/spec/components/stylesheet/compiler_spec.rb +++ b/spec/components/stylesheet/compiler_spec.rb @@ -40,6 +40,7 @@ describe Stylesheet::Compiler do after do Discourse.plugins.pop Stylesheet::Importer.register_imports! + DiscoursePluginRegistry.reset! end it "does not include theme variables in plugins" do diff --git a/spec/components/stylesheet/manager_spec.rb b/spec/components/stylesheet/manager_spec.rb index e7054f3b7a3..95ca08b6abb 100644 --- a/spec/components/stylesheet/manager_spec.rb +++ b/spec/components/stylesheet/manager_spec.rb @@ -68,7 +68,7 @@ describe Stylesheet::Manager do describe 'digest' do after do - DiscoursePluginRegistry.stylesheets.delete "fake_file" + DiscoursePluginRegistry.reset! end it 'can correctly account for plugins in digest' do diff --git a/spec/lib/content_security_policy_spec.rb b/spec/lib/content_security_policy_spec.rb index df0b66a1d0b..276dcb00390 100644 --- a/spec/lib/content_security_policy_spec.rb +++ b/spec/lib/content_security_policy_spec.rb @@ -4,6 +4,10 @@ require 'rails_helper' describe ContentSecurityPolicy do before { ContentSecurityPolicy.base_url = nil } + after do + DiscoursePluginRegistry.reset! + end + describe 'report-uri' do it 'is enabled by SiteSetting' do SiteSetting.content_security_policy_collect_reports = true