mirror of https://github.com/rails/rails
Expose Instrumenter id in Notifications.
This commit is contained in:
parent
562a00ba16
commit
45462c5e41
|
@ -4,6 +4,8 @@ require 'active_support/core_ext/module/delegation'
|
||||||
module ActiveSupport
|
module ActiveSupport
|
||||||
module Notifications
|
module Notifications
|
||||||
class Instrumenter
|
class Instrumenter
|
||||||
|
attr_reader :id
|
||||||
|
|
||||||
def initialize(notifier)
|
def initialize(notifier)
|
||||||
@id = unique_id
|
@id = unique_id
|
||||||
@notifier = notifier
|
@notifier = notifier
|
||||||
|
|
|
@ -86,6 +86,10 @@ module Notifications
|
||||||
assert_equal 2, @notifier.instrument(:awesome) { 1 + 1 }
|
assert_equal 2, @notifier.instrument(:awesome) { 1 + 1 }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_instrumenter_exposes_its_id
|
||||||
|
assert_equal 20, ActiveSupport::Notifications::Instrumenter.new(@notifier).id.size
|
||||||
|
end
|
||||||
|
|
||||||
def test_nested_events_can_be_instrumented
|
def test_nested_events_can_be_instrumented
|
||||||
@notifier.instrument(:awesome, :payload => "notifications") do
|
@notifier.instrument(:awesome, :payload => "notifications") do
|
||||||
@notifier.instrument(:wot, :payload => "child") do
|
@notifier.instrument(:wot, :payload => "child") do
|
||||||
|
|
Loading…
Reference in New Issue