diff options
Diffstat (limited to 'activesupport/test/notifications_test.rb')
-rw-r--r-- | activesupport/test/notifications_test.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/activesupport/test/notifications_test.rb b/activesupport/test/notifications_test.rb index 226e12ff75..3690d723fa 100644 --- a/activesupport/test/notifications_test.rb +++ b/activesupport/test/notifications_test.rb @@ -83,10 +83,20 @@ module Notifications end class InstrumentationTest < TestCase - delegate :instrument, :to => ActiveSupport::Notifications + delegate :instrument, :instrument!, :to => ActiveSupport::Notifications def test_instrument_returns_block_result assert_equal 2, instrument(:awesome) { 1 + 1 } + drain + end + + def test_instrument_with_band_adds_result_to_payload + assert_equal 2, instrument!(:awesome) { 1 + 1 } + drain + + assert_equal 1, @events.size + assert_equal :awesome, @events.first.name + assert_equal Hash[:result => 2], @events.first.payload end def test_instrumenter_exposes_its_id |