From 711d232f9344173d6a3f63d5239fe9a41f10e9bc Mon Sep 17 00:00:00 2001 From: mmmpa Date: Mon, 16 May 2016 13:07:35 +0900 Subject: Add guard to broadcast. --- .../test/subscription_adapter/subscriber_map_test.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 actioncable/test/subscription_adapter/subscriber_map_test.rb (limited to 'actioncable/test') diff --git a/actioncable/test/subscription_adapter/subscriber_map_test.rb b/actioncable/test/subscription_adapter/subscriber_map_test.rb new file mode 100644 index 0000000000..5965ac2b90 --- /dev/null +++ b/actioncable/test/subscription_adapter/subscriber_map_test.rb @@ -0,0 +1,17 @@ +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 -- cgit v1.2.3