diff options
author | Joel Hawksley <joelhawksley@github.com> | 2019-06-03 08:27:09 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-03 08:27:09 -0600 |
commit | 60af9db3745f994e8a4bd7afe9dfa6ea8be7bb7c (patch) | |
tree | 99c9199bf71835f18e2c746b04abe70569e5baed /activesupport/test/notifications_test.rb | |
parent | a85c372798723b900762c27e62c35689905327aa (diff) | |
parent | c926ca46280aee795b98206dd0707a96b9423cc5 (diff) | |
download | rails-60af9db3745f994e8a4bd7afe9dfa6ea8be7bb7c.tar.gz rails-60af9db3745f994e8a4bd7afe9dfa6ea8be7bb7c.tar.bz2 rails-60af9db3745f994e8a4bd7afe9dfa6ea8be7bb7c.zip |
Merge pull request #2 from rails/master
merge master
Diffstat (limited to 'activesupport/test/notifications_test.rb')
-rw-r--r-- | activesupport/test/notifications_test.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/activesupport/test/notifications_test.rb b/activesupport/test/notifications_test.rb index 3b98749f1b..02b90b0297 100644 --- a/activesupport/test/notifications_test.rb +++ b/activesupport/test/notifications_test.rb @@ -113,6 +113,24 @@ module Notifications assert_equal expected, events end + def test_subscribed_all_messages + name = "foo" + name2 = name * 2 + expected = [name, name2, name] + + events = [] + callback = lambda { |*_| events << _.first } + ActiveSupport::Notifications.subscribed(callback) do + ActiveSupport::Notifications.instrument(name) + ActiveSupport::Notifications.instrument(name2) + ActiveSupport::Notifications.instrument(name) + end + assert_equal expected, events + + ActiveSupport::Notifications.instrument(name) + assert_equal expected, events + end + def test_subscribing_to_instrumentation_while_inside_it # the repro requires that there are no evented subscribers for the "foo" event, # so we have to duplicate some of the setup code |