aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/notifications_test.rb
diff options
context:
space:
mode:
authorzvkemp <zvkemp@gmail.com>2019-02-07 11:58:50 -0800
committerzvkemp <zvkemp@gmail.com>2019-02-11 16:04:25 -0800
commit94f8e8c8f73b7034a9cc3e7f6bf040350aa9701f (patch)
tree3485dfb7b565555445cd44865f9074dfef233b6d /activesupport/test/notifications_test.rb
parentb67d5c6dedbf033515a96a95d24d085bf99a0d07 (diff)
downloadrails-94f8e8c8f73b7034a9cc3e7f6bf040350aa9701f.tar.gz
rails-94f8e8c8f73b7034a9cc3e7f6bf040350aa9701f.tar.bz2
rails-94f8e8c8f73b7034a9cc3e7f6bf040350aa9701f.zip
use a proxy matcher for AS::N fanout
Diffstat (limited to 'activesupport/test/notifications_test.rb')
-rw-r--r--activesupport/test/notifications_test.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/activesupport/test/notifications_test.rb b/activesupport/test/notifications_test.rb
index b5d72d1a42..bb20d26a25 100644
--- a/activesupport/test/notifications_test.rb
+++ b/activesupport/test/notifications_test.rb
@@ -128,6 +128,25 @@ module Notifications
assert_equal [["named.subscription", :foo], ["named.subscription", :foo]], @events
end
+ def test_unsubscribing_by_name_leaves_regexp_matched_subscriptions
+ @matched_events = []
+ @notifier.subscribe(/subscription/) { |*args| @matched_events << event(*args) }
+ @notifier.publish("named.subscription", :before)
+ @notifier.wait
+ [@events, @named_events, @matched_events].each do |collector|
+ assert_includes(collector, ["named.subscription", :before])
+ end
+ @notifier.unsubscribe("named.subscription")
+ @notifier.publish("named.subscription", :after)
+ @notifier.publish("other.subscription", :after)
+ @notifier.wait
+ assert_includes(@events, ["named.subscription", :after])
+ assert_includes(@events, ["other.subscription", :after])
+ assert_includes(@matched_events, ["other.subscription", :after])
+ assert_not_includes(@matched_events, ["named.subscription", :after])
+ assert_not_includes(@named_events, ["named.subscription", :after])
+ end
+
private
def event(*args)
args