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:
parent
b0a16a9776
commit
5e0c423881
1 changed files with 12 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue