aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/test
diff options
context:
space:
mode:
authormmmpa <mmmpa.mmmpa@gmail.com>2016-05-16 13:07:35 +0900
committermmmpa <mmmpa.mmmpa@gmail.com>2016-05-26 05:22:56 +0900
commit711d232f9344173d6a3f63d5239fe9a41f10e9bc (patch)
treebb4a4c3b0186bdc379ad7dce81e05fbfc96839e9 /actioncable/test
parente0dbf155ed8f1047f5bca22a4b3718f063d968a0 (diff)
downloadrails-711d232f9344173d6a3f63d5239fe9a41f10e9bc.tar.gz
rails-711d232f9344173d6a3f63d5239fe9a41f10e9bc.tar.bz2
rails-711d232f9344173d6a3f63d5239fe9a41f10e9bc.zip
Add guard to broadcast.
Diffstat (limited to 'actioncable/test')
-rw-r--r--actioncable/test/subscription_adapter/subscriber_map_test.rb17
1 files changed, 17 insertions, 0 deletions
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