diff options
Diffstat (limited to 'actioncable/test/connection/client_socket_test.rb')
-rw-r--r-- | actioncable/test/connection/client_socket_test.rb | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/actioncable/test/connection/client_socket_test.rb b/actioncable/test/connection/client_socket_test.rb index fe9077ae7f..5043a63370 100644 --- a/actioncable/test/connection/client_socket_test.rb +++ b/actioncable/test/connection/client_socket_test.rb @@ -1,5 +1,5 @@ -require 'test_helper' -require 'stubs/test_server' +require "test_helper" +require "stubs/test_server" class ActionCable::Connection::ClientSocketTest < ActionCable::TestCase class Connection < ActionCable::Connection::Base @@ -32,31 +32,31 @@ class ActionCable::Connection::ClientSocketTest < ActionCable::TestCase @server.config.allowed_request_origins = %w( http://rubyonrails.com ) end - test 'delegate socket errors to on_error handler' do - skip if ENV['FAYE'].present? + test "delegate socket errors to on_error handler" do + skip if ENV["FAYE"].present? run_in_eventmachine do connection = open_connection # Internal hax = :( client = connection.websocket.send(:websocket) - client.instance_variable_get('@stream').expects(:write).raises('foo') + client.instance_variable_get("@stream").expects(:write).raises("foo") client.expects(:client_gone).never - client.write('boo') + client.write("boo") assert_equal %w[ foo ], connection.errors end end - test 'closes hijacked i/o socket at shutdown' do - skip if ENV['FAYE'].present? + test "closes hijacked i/o socket at shutdown" do + skip if ENV["FAYE"].present? run_in_eventmachine do connection = open_connection client = connection.websocket.send(:websocket) - client.instance_variable_get('@stream') - .instance_variable_get('@rack_hijack_io') + client.instance_variable_get("@stream") + .instance_variable_get("@rack_hijack_io") .expects(:close) connection.close end @@ -64,10 +64,10 @@ class ActionCable::Connection::ClientSocketTest < ActionCable::TestCase private def open_connection - env = Rack::MockRequest.env_for '/test', - 'HTTP_CONNECTION' => 'upgrade', 'HTTP_UPGRADE' => 'websocket', - 'HTTP_HOST' => 'localhost', 'HTTP_ORIGIN' => 'http://rubyonrails.com' - env['rack.hijack'] = -> { env['rack.hijack_io'] = StringIO.new } + env = Rack::MockRequest.env_for "/test", + "HTTP_CONNECTION" => "upgrade", "HTTP_UPGRADE" => "websocket", + "HTTP_HOST" => "localhost", "HTTP_ORIGIN" => "http://rubyonrails.com" + env["rack.hijack"] = -> { env["rack.hijack_io"] = StringIO.new } Connection.new(@server, env).tap do |connection| connection.process |