Methods
T
Instance Public methods
test_events_are_published_to_a_listener()
# File activesupport/test/notifications_test.rb, line 85
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 125
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 113
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 137
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_publishing_after_a_new_subscribe_works()
# File activesupport/test/notifications_test.rb, line 98
def test_publishing_after_a_new_subscribe_works
  @notifier.publish :foo
  @notifier.publish :foo

  @notifier.subscribe("not_existant") 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 91
def test_publishing_multiple_times_works
  @notifier.publish :foo
  @notifier.publish :foo
  @notifier.wait
  assert_equal [[:foo], [:foo]], @events
end