Methods
T
Instance Public methods
test_events_are_published_to_a_listener()
# File activesupport/test/notifications_test.rb, line 114
def test_events_are_published_to_a_listener
  @notifier.publish :foo
  @notifier.wait
  assert_equal [[:foo]], @events
end
test_log_subscriber_with_pattern()
# File activesupport/test/notifications_test.rb, line 154
def test_log_subscriber_with_pattern
  events = []
  @notifier.subscribe(/\d/) { |*args| events << args }

  @notifier.publish '1'
  @notifier.publish 'a.1'
  @notifier.publish '1.a'
  @notifier.wait

  assert_equal [['1'], ['a.1'], ['1.a']], events
end
test_log_subscriber_with_string()
# File activesupport/test/notifications_test.rb, line 142
def test_log_subscriber_with_string
  events = []
  @notifier.subscribe('1') { |*args| events << args }

  @notifier.publish '1'
  @notifier.publish '1.a'
  @notifier.publish 'a.1'
  @notifier.wait

  assert_equal [['1']], events
end
test_multiple_log_subscribers()
# File activesupport/test/notifications_test.rb, line 166
def test_multiple_log_subscribers
  @another = []
  @notifier.subscribe { |*args| @another << args }
  @notifier.publish :foo
  @notifier.wait

  assert_equal [[:foo]], @events
  assert_equal [[:foo]], @another
end
test_publish_with_subscriber()
# File activesupport/test/notifications_test.rb, line 176
def test_publish_with_subscriber
  subscriber = TestSubscriber.new
  @notifier.subscribe nil, subscriber
  @notifier.publish :foo

  assert_equal [[:foo]], subscriber.publishes
end
test_publishing_after_a_new_subscribe_works()
# File activesupport/test/notifications_test.rb, line 127
def test_publishing_after_a_new_subscribe_works
  @notifier.publish :foo
  @notifier.publish :foo

  @notifier.subscribe("not_existent") do |*args|
    @events << ActiveSupport::Notifications::Event.new(*args)
  end

  @notifier.publish :foo
  @notifier.publish :foo
  @notifier.wait

  assert_equal [[:foo]] * 4, @events
end
test_publishing_multiple_times_works()
# File activesupport/test/notifications_test.rb, line 120
def test_publishing_multiple_times_works
  @notifier.publish :foo
  @notifier.publish :foo
  @notifier.wait
  assert_equal [[:foo], [:foo]], @events
end