aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/log_subscriber_test.rb
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@github.com>2018-07-26 11:45:31 -0700
committerGitHub <noreply@github.com>2018-07-26 11:45:31 -0700
commitf0c917c7d491f4f7b142748375e1128d5579152a (patch)
treedc0933afa79eb8092ea609729b5b63d067ea4c02 /activesupport/test/log_subscriber_test.rb
parent5f92e43af1ba1413b40d25c99741812a103e02b8 (diff)
parent42fec4b8de8c40d7778f936e200081c0dded1ed0 (diff)
downloadrails-f0c917c7d491f4f7b142748375e1128d5579152a.tar.gz
rails-f0c917c7d491f4f7b142748375e1128d5579152a.tar.bz2
rails-f0c917c7d491f4f7b142748375e1128d5579152a.zip
Merge pull request #33449 from rails/use-process-clock-instead-of-time
Add cpu time, idle time, and allocations features to log subscriber events
Diffstat (limited to 'activesupport/test/log_subscriber_test.rb')
-rw-r--r--activesupport/test/log_subscriber_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/activesupport/test/log_subscriber_test.rb b/activesupport/test/log_subscriber_test.rb
index 2af9b1de30..4f413b9627 100644
--- a/activesupport/test/log_subscriber_test.rb
+++ b/activesupport/test/log_subscriber_test.rb
@@ -75,6 +75,17 @@ class SyncLogSubscriberTest < ActiveSupport::TestCase
assert_kind_of ActiveSupport::Notifications::Event, @log_subscriber.event
end
+ def test_event_attributes
+ ActiveSupport::LogSubscriber.attach_to :my_log_subscriber, @log_subscriber
+ instrument "some_event.my_log_subscriber"
+ wait
+ event = @log_subscriber.event
+ assert_operator event.duration, :>, 0
+ assert_operator event.cpu_time, :>, 0
+ assert_operator event.idle_time, :>, 0
+ assert_operator event.allocations, :>, 0
+ end
+
def test_does_not_send_the_event_if_it_doesnt_match_the_class
ActiveSupport::LogSubscriber.attach_to :my_log_subscriber, @log_subscriber
instrument "unknown_event.my_log_subscriber"