diff options
author | zvkemp <zvkemp@gmail.com> | 2019-02-07 11:58:50 -0800 |
---|---|---|
committer | zvkemp <zvkemp@gmail.com> | 2019-02-11 16:04:25 -0800 |
commit | 94f8e8c8f73b7034a9cc3e7f6bf040350aa9701f (patch) | |
tree | 3485dfb7b565555445cd44865f9074dfef233b6d /activesupport/test/notifications/evented_notification_test.rb | |
parent | b67d5c6dedbf033515a96a95d24d085bf99a0d07 (diff) | |
download | rails-94f8e8c8f73b7034a9cc3e7f6bf040350aa9701f.tar.gz rails-94f8e8c8f73b7034a9cc3e7f6bf040350aa9701f.tar.bz2 rails-94f8e8c8f73b7034a9cc3e7f6bf040350aa9701f.zip |
use a proxy matcher for AS::N fanout
Diffstat (limited to 'activesupport/test/notifications/evented_notification_test.rb')
-rw-r--r-- | activesupport/test/notifications/evented_notification_test.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/activesupport/test/notifications/evented_notification_test.rb b/activesupport/test/notifications/evented_notification_test.rb index 4beb8194b9..ab2a9b8659 100644 --- a/activesupport/test/notifications/evented_notification_test.rb +++ b/activesupport/test/notifications/evented_notification_test.rb @@ -84,6 +84,39 @@ module ActiveSupport [:finish, "hi", 1, {}] ], listener.events end + + def test_listen_to_regexp + notifier = Fanout.new + listener = Listener.new + notifier.subscribe(/[a-z]*.world/, listener) + notifier.start("hi.world", 1, {}) + notifier.finish("hi.world", 2, {}) + notifier.start("hello.world", 1, {}) + notifier.finish("hello.world", 2, {}) + + assert_equal [ + [:start, "hi.world", 1, {}], + [:finish, "hi.world", 2, {}], + [:start, "hello.world", 1, {}], + [:finish, "hello.world", 2, {}] + ], listener.events + end + + def test_listen_to_regexp_with_exclusions + notifier = Fanout.new + listener = Listener.new + notifier.subscribe(/[a-z]*.world/, listener) + notifier.unsubscribe("hi.world") + notifier.start("hi.world", 1, {}) + notifier.finish("hi.world", 2, {}) + notifier.start("hello.world", 1, {}) + notifier.finish("hello.world", 2, {}) + + assert_equal [ + [:start, "hello.world", 1, {}], + [:finish, "hello.world", 2, {}] + ], listener.events + end end end end |