File tree Expand file tree Collapse file tree 2 files changed +26
-12
lines changed
Expand file tree Collapse file tree 2 files changed +26
-12
lines changed Original file line number Diff line number Diff line change @@ -41,8 +41,8 @@ def initialize(client, connection)
4141 super ( connection )
4242 end
4343
44- def close
45- super
44+ def close ( ... )
45+ super ( ... )
4646
4747 if @client
4848 @client . close
Original file line number Diff line number Diff line change 2020 end
2121 end
2222
23- it "can connect to a websocket server and close underlying client" do
24- Async do |task |
25- connection = Async ::WebSocket ::Client . connect ( client_endpoint )
26- connection . send_text ( "Hello World!" )
27- message = connection . read
28- expect ( message . to_str ) . to be == "Hello World!"
29-
30- connection . close
31- expect ( task . children ) . to be ( :empty? )
32- end . wait
23+ with '#close' do
24+ it "can connect to a websocket server and close underlying client" do
25+ Async do |task |
26+ connection = Async ::WebSocket ::Client . connect ( client_endpoint )
27+ connection . send_text ( "Hello World!" )
28+ message = connection . read
29+ expect ( message . to_str ) . to be == "Hello World!"
30+
31+ connection . close
32+ expect ( task . children ) . to be ( :empty? )
33+ end . wait
34+ end
35+
36+ it "can connect to a websocket server and close underlying client with an error code" do
37+ Async do |task |
38+ connection = Async ::WebSocket ::Client . connect ( client_endpoint )
39+ connection . send_text ( "Hello World!" )
40+ message = connection . read
41+ expect ( message . to_str ) . to be == "Hello World!"
42+
43+ connection . close ( Protocol ::WebSocket ::Error ::GOING_AWAY , "Bye!" )
44+ expect ( task . children ) . to be ( :empty? )
45+ end . wait
46+ end
3347 end
3448
3549 with 'missing support for websockets' do
You can’t perform that action at this time.
0 commit comments