Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7a28874

Browse files
committed
Improve connection handling in tests.
1 parent a069490 commit 7a28874

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lib/async/websocket/connection.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ def reusable?
4242
end
4343

4444
attr :protocol
45+
46+
def inspect
47+
"#<#{self.class} state=#{@state}>"
48+
end
4549
end
4650
end
4751
end

test/async/websocket/server.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
message = connection.read
2020
expect(message.to_str).to be == "Hello World!"
2121

22+
connection.shutdown
23+
ensure
2224
connection.close
2325
end
2426

@@ -27,6 +29,8 @@
2729
connection.send_text("Hello World!")
2830
message = connection.read
2931
expect(message.to_str).to be == "Hello World!"
32+
33+
connection.shutdown
3034
end
3135
end
3236

@@ -36,6 +40,8 @@
3640
connection.send_text("Hello World!")
3741
message = connection.read
3842
expect(message.to_str).to be == "Hello World!"
43+
44+
connection.shutdown
3945
end
4046
end
4147
end

0 commit comments

Comments
 (0)