1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Subscribe to event objects via subscribe

This commit is contained in:
Aaron Patterson 2018-07-26 12:05:23 -07:00
parent b0a16a9776
commit 5e0c423881
No known key found for this signature in database
GPG key ID: 953170BCB4FFAFC6

View file

@ -41,6 +41,18 @@ module Notifications
assert_operator event.idle_time, :>, 0
assert_operator event.duration, :>, 0
end
def test_subscribe_via_subscribe_method
events = []
@notifier.subscribe do |event|
events << event
end
ActiveSupport::Notifications.instrument("foo")
event = events.first
assert event, "should have an event"
assert_operator event.allocations, :>, 0
end
end
class SubscribedTest < TestCase