aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-01-13 22:28:18 +0100
committerJosé Valim <jose.valim@gmail.com>2010-01-14 01:07:03 +0100
commit7c3573f32757e9c4c6b6140499a3e7dfe2d335b1 (patch)
tree957230806ab62a1875a789c285337817cb610c79 /activesupport/test
parent2a6bc1263e99060897b53a8c806916d198eab572 (diff)
downloadrails-7c3573f32757e9c4c6b6140499a3e7dfe2d335b1.tar.gz
rails-7c3573f32757e9c4c6b6140499a3e7dfe2d335b1.tar.bz2
rails-7c3573f32757e9c4c6b6140499a3e7dfe2d335b1.zip
Add instrument! to notifications which adds the result to the payload.
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/notifications_test.rb12
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