From 322dca293b3716ccaa09e7e82046e539b0d2ffda Mon Sep 17 00:00:00 2001 From: Matthew Draper Date: Thu, 21 Jan 2016 14:59:11 +1030 Subject: Import the relevant portions of faye-websocket (as adapted to use concurrent-ruby / nio4r instead of eventmachine) --- actioncable/test/connection/base_test.rb | 6 +++--- actioncable/test/connection/identifier_test.rb | 4 ++-- actioncable/test/connection/multiple_identifiers_test.rb | 4 ++-- actioncable/test/stubs/test_server.rb | 3 ++- 4 files changed, 9 insertions(+), 8 deletions(-) (limited to 'actioncable/test') diff --git a/actioncable/test/connection/base_test.rb b/actioncable/test/connection/base_test.rb index 579578d0a7..e2b017a9a1 100644 --- a/actioncable/test/connection/base_test.rb +++ b/actioncable/test/connection/base_test.rb @@ -55,11 +55,11 @@ class ActionCable::Connection::BaseTest < ActionCable::TestCase test "on connection open" do run_in_eventmachine do connection = open_connection - connection.process connection.websocket.expects(:transmit).with(regexp_matches(/\_ping/)) connection.message_buffer.expects(:process!) + connection.process wait_for_async assert_equal [ connection ], @server.connections @@ -74,11 +74,11 @@ class ActionCable::Connection::BaseTest < ActionCable::TestCase # Setup the connection Concurrent::TimerTask.stubs(:new).returns(true) - connection.send :on_open + connection.send :handle_open assert connection.connected connection.subscriptions.expects(:unsubscribe_from_all) - connection.send :on_close + connection.send :handle_close assert ! connection.connected assert_equal [], @server.connections diff --git a/actioncable/test/connection/identifier_test.rb b/actioncable/test/connection/identifier_test.rb index a110dfdee0..1019ad541e 100644 --- a/actioncable/test/connection/identifier_test.rb +++ b/actioncable/test/connection/identifier_test.rb @@ -68,10 +68,10 @@ class ActionCable::Connection::IdentifierTest < ActionCable::TestCase @connection = Connection.new(server, env) @connection.process - @connection.send :on_open + @connection.send :handle_open end def close_connection - @connection.send :on_close + @connection.send :handle_close end end diff --git a/actioncable/test/connection/multiple_identifiers_test.rb b/actioncable/test/connection/multiple_identifiers_test.rb index 55a9f96cb3..e9bb4e6d7f 100644 --- a/actioncable/test/connection/multiple_identifiers_test.rb +++ b/actioncable/test/connection/multiple_identifiers_test.rb @@ -32,10 +32,10 @@ class ActionCable::Connection::MultipleIdentifiersTest < ActionCable::TestCase @connection = Connection.new(server, env) @connection.process - @connection.send :on_open + @connection.send :handle_open end def close_connection - @connection.send :on_close + @connection.send :handle_close end end diff --git a/actioncable/test/stubs/test_server.rb b/actioncable/test/stubs/test_server.rb index 6e6541a952..56d132b30a 100644 --- a/actioncable/test/stubs/test_server.rb +++ b/actioncable/test/stubs/test_server.rb @@ -14,6 +14,7 @@ class TestServer @config.subscription_adapter.new(self) end - def send_async + def stream_event_loop + @stream_event_loop ||= ActionCable::Connection::StreamEventLoop.new end end -- cgit v1.2.3