diff options
author | Mick Staugaard <mick@staugaard.com> | 2018-10-11 13:47:16 -0700 |
---|---|---|
committer | Mick Staugaard <mick@staugaard.com> | 2018-12-05 10:40:29 -0800 |
commit | 58dbc1c2ed0e372d9cae4c9e3baebb679a726dc3 (patch) | |
tree | 9cfd085ce218a95879df56e8008d54978026e134 /actioncable/test/connection | |
parent | b802e08273f899d5f3b199f7c6a4f5d514c1b0e1 (diff) | |
download | rails-58dbc1c2ed0e372d9cae4c9e3baebb679a726dc3.tar.gz rails-58dbc1c2ed0e372d9cae4c9e3baebb679a726dc3.tar.bz2 rails-58dbc1c2ed0e372d9cae4c9e3baebb679a726dc3.zip |
Stop trying to reconnect on unauthorized cable connections
Diffstat (limited to 'actioncable/test/connection')
-rw-r--r-- | actioncable/test/connection/authorization_test.rb | 7 | ||||
-rw-r--r-- | actioncable/test/connection/base_test.rb | 2 | ||||
-rw-r--r-- | actioncable/test/connection/client_socket_test.rb | 2 |
3 files changed, 7 insertions, 4 deletions
diff --git a/actioncable/test/connection/authorization_test.rb b/actioncable/test/connection/authorization_test.rb index f77e543435..ac5c128135 100644 --- a/actioncable/test/connection/authorization_test.rb +++ b/actioncable/test/connection/authorization_test.rb @@ -25,8 +25,11 @@ class ActionCable::Connection::AuthorizationTest < ActionCable::TestCase "HTTP_HOST" => "localhost", "HTTP_ORIGIN" => "http://rubyonrails.com" connection = Connection.new(server, env) - assert_called(connection.websocket, :close) do - connection.process + + assert_called_with(connection.websocket, :transmit, [{ type: "disconnect", reason: "unauthorized", reconnect: false }.to_json]) do + assert_called(connection.websocket, :close) do + connection.process + end end end end diff --git a/actioncable/test/connection/base_test.rb b/actioncable/test/connection/base_test.rb index 6ffa0961bc..299879ad4c 100644 --- a/actioncable/test/connection/base_test.rb +++ b/actioncable/test/connection/base_test.rb @@ -108,7 +108,7 @@ class ActionCable::Connection::BaseTest < ActionCable::TestCase connection.process assert_called(connection.websocket, :close) do - connection.close + connection.close(reason: "testing") end end end diff --git a/actioncable/test/connection/client_socket_test.rb b/actioncable/test/connection/client_socket_test.rb index a7db32c3e4..1ab3c3b71d 100644 --- a/actioncable/test/connection/client_socket_test.rb +++ b/actioncable/test/connection/client_socket_test.rb @@ -58,7 +58,7 @@ class ActionCable::Connection::ClientSocketTest < ActionCable::TestCase client.instance_variable_get("@stream") .instance_variable_get("@rack_hijack_io") .define_singleton_method(:close) { event.set } - connection.close + connection.close(reason: "testing") event.wait end end |