Methods
T
Instance Public methods
test_subscribed()
   # File activesupport/test/notifications_test.rb
66 def test_subscribed
67   name     = "foo"
68   name2    = name * 2
69   expected = [name, name]
70 
71   events   = []
72   callback = lambda { |*_| events << _.first }
73   ActiveSupport::Notifications.subscribed(callback, name) do
74     ActiveSupport::Notifications.instrument(name)
75     ActiveSupport::Notifications.instrument(name2)
76     ActiveSupport::Notifications.instrument(name)
77   end
78   assert_equal expected, events
79 
80   ActiveSupport::Notifications.instrument(name)
81   assert_equal expected, events
82 end
test_subscribing_to_instrumentation_while_inside_it()
   # File activesupport/test/notifications_test.rb
84 def test_subscribing_to_instrumentation_while_inside_it
85   # the repro requires that there are no evented subscribers for the "foo" event,
86   # so we have to duplicate some of the setup code
87   old_notifier = ActiveSupport::Notifications.notifier
88   ActiveSupport::Notifications.notifier = ActiveSupport::Notifications::Fanout.new
89 
90   ActiveSupport::Notifications.subscribe("foo", TestSubscriber.new)
91 
92   ActiveSupport::Notifications.instrument("foo") do
93     ActiveSupport::Notifications.subscribe("foo") { }
94   end
95 ensure
96   ActiveSupport::Notifications.notifier = old_notifier
97 end