Skip to content

A platform for community discussion. Free, open, simple.

DEV: Don't wipe registered push notification filters in specs (#44550)

Régis Hanol01ef0bc60bc9
diff --git a/plugins/chat/spec/jobs/regular/chat/notify_watching_spec.rb b/plugins/chat/spec/jobs/regular/chat/notify_watching_spec.rb
index c1ffc445b7a..cc8c37842fa 100644
--- a/plugins/chat/spec/jobs/regular/chat/notify_watching_spec.rb
+++ b/plugins/chat/spec/jobs/regular/chat/notify_watching_spec.rb
@@ -203,7 +203,9 @@ RSpec.describe Jobs::Chat::NotifyWatching do
end
context "with push_notification_filter registered to block push notifications" do
- after { DiscoursePluginRegistry.reset_register!(:push_notification_filters) }
+ let!(:original_filters) { DiscoursePluginRegistry._raw_push_notification_filters.dup }
+
+ after { DiscoursePluginRegistry._raw_push_notification_filters.replace(original_filters) }
it "doesn't send notification alert via MessageBus" do
Plugin::Instance.new.register_push_notification_filter { |user, payload| false }
diff --git a/spec/services/post_alerter_spec.rb b/spec/services/post_alerter_spec.rb
index d362990f078..e48b13ee0b1 100644
--- a/spec/services/post_alerter_spec.rb
+++ b/spec/services/post_alerter_spec.rb
@@ -1306,7 +1306,9 @@ RSpec.describe PostAlerter do
end
describe "DiscoursePluginRegistry#push_notification_filters" do
- after { DiscoursePluginRegistry.reset_register!(:push_notification_filters) }
+ let!(:original_filters) { DiscoursePluginRegistry._raw_push_notification_filters.dup }
+
+ after { DiscoursePluginRegistry._raw_push_notification_filters.replace(original_filters) }
it "sends push notifications when all filters pass" do
evil_trout.update!(last_seen_at: 10.minutes.ago)