diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-03-27 17:43:33 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-03-27 17:43:33 -0300 |
commit | 57fbcc524780ce386241c8def372984583e585d6 (patch) | |
tree | 352595ed0054db18c8fa7ddf737ea976947e3379 /activesupport/test | |
parent | d684de49713aeae3ff492f554fa220c8ae3c57a1 (diff) | |
parent | a007800a552a9ab31c21134c2e716222268a1276 (diff) | |
download | rails-57fbcc524780ce386241c8def372984583e585d6.tar.gz rails-57fbcc524780ce386241c8def372984583e585d6.tar.bz2 rails-57fbcc524780ce386241c8def372984583e585d6.zip |
Merge pull request #9523 from stopdropandrew/Instrumenter#instrument-yields-payload
ActiveSupport::Notifications::Instrumenter#instrument should yield
Conflicts:
activesupport/CHANGELOG.md
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/notifications/instrumenter_test.rb | 8 | ||||
-rw-r--r-- | activesupport/test/notifications_test.rb | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/activesupport/test/notifications/instrumenter_test.rb b/activesupport/test/notifications/instrumenter_test.rb index 62a9b61464..f46e96f636 100644 --- a/activesupport/test/notifications/instrumenter_test.rb +++ b/activesupport/test/notifications/instrumenter_test.rb @@ -34,6 +34,14 @@ module ActiveSupport assert called end + def test_instrument_yields_the_payload_for_further_modification + assert_equal 2, instrumenter.instrument("awesome") { |p| p[:result] = 1 + 1 } + assert_equal 1, notifier.finishes.size + name, _, payload = notifier.finishes.first + assert_equal "awesome", name + assert_equal Hash[:result => 2], payload + end + def test_start instrumenter.start("foo", payload) assert_equal [["foo", instrumenter.id, payload]], notifier.starts diff --git a/activesupport/test/notifications_test.rb b/activesupport/test/notifications_test.rb index bcb393c7bc..d63c59883a 100644 --- a/activesupport/test/notifications_test.rb +++ b/activesupport/test/notifications_test.rb @@ -157,7 +157,7 @@ module Notifications assert_equal 2, instrument(:awesome) { 1 + 1 } end - def test_instrument_yields_the_paylod_for_further_modification + def test_instrument_yields_the_payload_for_further_modification assert_equal 2, instrument(:awesome) { |p| p[:result] = 1 + 1 } assert_equal 1, @events.size assert_equal :awesome, @events.first.name |