A platform for community discussion. Free, open, simple.
DEV: Leaking state in `PostActionNotifier` in tests take 2.
Guo Xiang Tan5270cd97ef12
diff --git a/app/services/post_action_notifier.rb b/app/services/post_action_notifier.rbindex 7644611cbda..3f562e327fe 100644--- a/app/services/post_action_notifier.rb+++ b/app/services/post_action_notifier.rb@@ -4,13 +4,17 @@ class PostActionNotifierdef self.disable@disabled = true- @custom_post_revision_notifier_recipients = nilenddef self.enable@disabled = falseend+ # For testing purposes+ def self.reset!+ @custom_post_revision_notifier_recipients = nil+ end+def self.alerter@alerter ||= PostAlerter.newenddiff --git a/spec/services/post_action_notifier_spec.rb b/spec/services/post_action_notifier_spec.rbindex 746c193b7b1..00d326ea22a 100644--- a/spec/services/post_action_notifier_spec.rb+++ b/spec/services/post_action_notifier_spec.rb@@ -108,6 +108,10 @@ describe PostActionNotifier doendend+ after do+ PostActionNotifier.reset!+ end+it 'notifies the specified user of the revision' doexpect {post.revise(evil_trout, raw: "world is the new body of the message")