aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/notifications_test.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-07-25 11:11:23 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-07-25 11:11:23 -0700
commitb7e0408ca922cf51228818edbfdcd5c63e3cb84e (patch)
tree0313ba10f8f42720b03b51fabc992d84c425d8cb /activesupport/test/notifications_test.rb
parentd02f2d2fb213584ce52a231063c948def856f657 (diff)
downloadrails-b7e0408ca922cf51228818edbfdcd5c63e3cb84e.tar.gz
rails-b7e0408ca922cf51228818edbfdcd5c63e3cb84e.tar.bz2
rails-b7e0408ca922cf51228818edbfdcd5c63e3cb84e.zip
use a hash to collect optional statistics about the instrumentation
Diffstat (limited to 'activesupport/test/notifications_test.rb')
-rw-r--r--activesupport/test/notifications_test.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/activesupport/test/notifications_test.rb b/activesupport/test/notifications_test.rb
index 9faa11efbc..41e8ca4ae7 100644
--- a/activesupport/test/notifications_test.rb
+++ b/activesupport/test/notifications_test.rb
@@ -172,6 +172,15 @@ module Notifications
:exception => ["RuntimeError", "FAIL"]], @events.last.payload
end
+ def test_elapsed
+ instrument(:something) do
+ sleep(0.001)
+ end
+
+ # Elapsed returns duration in ms
+ assert_in_delta 1, ActiveSupport::Notifications.instrumenter.elapsed, 100
+ end
+
def test_event_is_pushed_even_without_block
instrument(:awesome, :payload => "notifications")
assert_equal 1, @events.size