aboutsummaryrefslogtreecommitdiffstats
path: root/test/channel
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2015-10-15 21:11:49 -0500
committerPratik Naik <pratiknaik@gmail.com>2015-10-15 21:11:49 -0500
commitee16ca8990e80da731e6566b34640e65f6b337e6 (patch)
tree467f7b0c3acac7133ef61fe2bf7970321a98e2fa /test/channel
parentdb56e8bf3ba8f562219f9f87d300153e848ed8b2 (diff)
downloadrails-ee16ca8990e80da731e6566b34640e65f6b337e6.tar.gz
rails-ee16ca8990e80da731e6566b34640e65f6b337e6.tar.bz2
rails-ee16ca8990e80da731e6566b34640e65f6b337e6.zip
Run connection tests in EM loop
Diffstat (limited to 'test/channel')
-rw-r--r--test/channel/stream_test.rb23
1 files changed, 15 insertions, 8 deletions
diff --git a/test/channel/stream_test.rb b/test/channel/stream_test.rb
index b0a6f49072..5914b39be0 100644
--- a/test/channel/stream_test.rb
+++ b/test/channel/stream_test.rb
@@ -2,7 +2,7 @@ require 'test_helper'
require 'stubs/test_connection'
require 'stubs/room'
-class ActionCable::Channel::StreamTest < ActiveSupport::TestCase
+class ActionCable::Channel::StreamTest < ActionCable::TestCase
class ChatChannel < ActionCable::Channel::Base
def subscribed
if params[:id]
@@ -17,16 +17,23 @@ class ActionCable::Channel::StreamTest < ActiveSupport::TestCase
end
test "streaming start and stop" do
- @connection.expects(:pubsub).returns mock().tap { |m| m.expects(:subscribe).with("test_room_1") }
- channel = ChatChannel.new @connection, "{id: 1}", { id: 1 }
+ run_in_eventmachine do
+ @connection.expects(:pubsub).returns mock().tap { |m| m.expects(:subscribe).with("test_room_1") }
+ channel = ChatChannel.new @connection, "{id: 1}", { id: 1 }
- @connection.expects(:pubsub).returns mock().tap { |m| m.expects(:unsubscribe_proc) }
- channel.unsubscribe_from_channel
+ @connection.expects(:pubsub).returns mock().tap { |m| m.expects(:unsubscribe_proc) }
+ channel.unsubscribe_from_channel
+ end
end
test "stream_for" do
- @connection.expects(:pubsub).returns mock().tap { |m| m.expects(:subscribe).with("action_cable:channel:stream_test:chat:Room#1-Campfire") }
- channel = ChatChannel.new @connection, ""
- channel.stream_for Room.new(1)
+ run_in_eventmachine do
+ EM.next_tick do
+ @connection.expects(:pubsub).returns mock().tap { |m| m.expects(:subscribe).with("action_cable:channel:stream_test:chat:Room#1-Campfire") }
+ end
+
+ channel = ChatChannel.new @connection, ""
+ channel.stream_for Room.new(1)
+ end
end
end