aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/test/subscription_adapter/subscriber_map_test.rb
blob: ed81099cbc6e743aca05cdc3f57cc0639766c32b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

require "test_helper"

class SubscriberMapTest < ActionCable::TestCase
  test "broadcast should not change subscribers" do
    setup_subscription_map
    origin = @subscription_map.instance_variable_get(:@subscribers).dup

    @subscription_map.broadcast("not_exist_channel", "")

    assert_equal origin, @subscription_map.instance_variable_get(:@subscribers)
  end

  private
    def setup_subscription_map
      @subscription_map = ActionCable::SubscriptionAdapter::SubscriberMap.new
    end
end