class Notifications::UnsubscribeTest

Public Instance Methods

test_unsubscribing_by_name_leaves_the_other_subscriptions() click to toggle source
# File activesupport/test/notifications_test.rb, line 85
def test_unsubscribing_by_name_leaves_the_other_subscriptions
  @notifier.publish "named.subscription", :foo
  @notifier.wait
  assert_equal [["named.subscription", :foo]], @events
  @notifier.unsubscribe("named.subscription")
  @notifier.publish "named.subscription", :foo
  @notifier.wait
  assert_equal [["named.subscription", :foo], ["named.subscription", :foo]], @events
end
test_unsubscribing_by_name_removes_a_subscription() click to toggle source
# File activesupport/test/notifications_test.rb, line 75
def test_unsubscribing_by_name_removes_a_subscription
  @notifier.publish "named.subscription", :foo
  @notifier.wait
  assert_equal [["named.subscription", :foo]], @named_events
  @notifier.unsubscribe("named.subscription")
  @notifier.publish "named.subscription", :foo
  @notifier.wait
  assert_equal [["named.subscription", :foo]], @named_events
end
test_unsubscribing_removes_a_subscription() click to toggle source
# File activesupport/test/notifications_test.rb, line 65
def test_unsubscribing_removes_a_subscription
  @notifier.publish :foo
  @notifier.wait
  assert_equal [[:foo]], @events
  @notifier.unsubscribe(@subscription)
  @notifier.publish :foo
  @notifier.wait
  assert_equal [[:foo]], @events
end

Private Instance Methods

event(*args) click to toggle source
# File activesupport/test/notifications_test.rb, line 96
def event(*args)
  args
end