aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/test
diff options
context:
space:
mode:
authorJay Hayes <ur@iamvery.com>2016-02-24 12:35:36 -0600
committerJay Hayes <ur@iamvery.com>2016-02-24 12:43:23 -0600
commit046e32656efa989a112e9870d8aa25a49f944204 (patch)
tree15fb68344c6953873b0db062cea2618572d3e2c4 /actioncable/test
parentb42624725054f1c579d6a738701dfdbb2003f087 (diff)
downloadrails-046e32656efa989a112e9870d8aa25a49f944204.tar.gz
rails-046e32656efa989a112e9870d8aa25a49f944204.tar.bz2
rails-046e32656efa989a112e9870d8aa25a49f944204.zip
Convert stream broadcasting to a string
ActionCable does some things behind the scenes that expects these "broadcasting"s or "channel"s to be strings. However it's not immediately obvious that the value must be a string. So adding this conversion ensures things work as expected.
Diffstat (limited to 'actioncable/test')
-rw-r--r--actioncable/test/channel/stream_test.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/actioncable/test/channel/stream_test.rb b/actioncable/test/channel/stream_test.rb
index ecbee52a4f..526ea92e4f 100644
--- a/actioncable/test/channel/stream_test.rb
+++ b/actioncable/test/channel/stream_test.rb
@@ -16,6 +16,12 @@ class ActionCable::Channel::StreamTest < ActionCable::TestCase
end
end
+ class SymbolChannel < ActionCable::Channel::Base
+ def subscribed
+ stream_from :channel
+ end
+ end
+
test "streaming start and stop" do
run_in_eventmachine do
connection = TestConnection.new
@@ -27,6 +33,17 @@ class ActionCable::Channel::StreamTest < ActionCable::TestCase
end
end
+ test "stream from non-string channel" do
+ run_in_eventmachine do
+ connection = TestConnection.new
+ connection.expects(:pubsub).returns mock().tap { |m| m.expects(:subscribe).with("channel", kind_of(Proc), kind_of(Proc)).returns stub_everything(:pubsub) }
+ channel = SymbolChannel.new connection, ""
+
+ connection.expects(:pubsub).returns mock().tap { |m| m.expects(:unsubscribe) }
+ channel.unsubscribe_from_channel
+ end
+ end
+
test "stream_for" do
run_in_eventmachine do
connection = TestConnection.new