aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2015-08-09 20:43:15 +0900
committerKazuki Yamaguchi <k@rhe.jp>2015-08-09 20:43:15 +0900
commita44c391cf861b7bd8331de94026cb21f154b1716 (patch)
treecfa702cd0f316ef1fcbba88cc7da14189b0c7586 /test
parent45b442f9a94704bff326b1866d6523a253492860 (diff)
downloadplum-a44c391cf861b7bd8331de94026cb21f154b1716.tar.gz
connection: split Connection#close into #goaway and #close
Diffstat (limited to 'test')
-rw-r--r--test/plum/test_connection_helper.rb16
-rw-r--r--test/plum/test_connection_utils.rb29
-rw-r--r--test/plum/test_frame_utils.rb (renamed from test/plum/test_frame_helper.rb)2
3 files changed, 30 insertions, 17 deletions
diff --git a/test/plum/test_connection_helper.rb b/test/plum/test_connection_helper.rb
deleted file mode 100644
index 383679c..0000000
--- a/test/plum/test_connection_helper.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-require "test_helper"
-
-using BinaryString
-
-class ServerConnectionHelperTest < Minitest::Test
- def test_server_ping
- open_server_connection {|con|
- con.ping("ABCABCAB")
-
- last = sent_frames.last
- assert_equal(:ping, last.type)
- assert_equal([], last.flags)
- assert_equal("ABCABCAB", last.payload)
- }
- end
-end
diff --git a/test/plum/test_connection_utils.rb b/test/plum/test_connection_utils.rb
new file mode 100644
index 0000000..926d21d
--- /dev/null
+++ b/test/plum/test_connection_utils.rb
@@ -0,0 +1,29 @@
+require "test_helper"
+
+using BinaryString
+
+class ServerConnectionUtilsTest < Minitest::Test
+ def test_server_ping
+ open_server_connection {|con|
+ con.ping("ABCABCAB")
+
+ last = sent_frames.last
+ assert_equal(:ping, last.type)
+ assert_equal([], last.flags)
+ assert_equal("ABCABCAB", last.payload)
+ }
+ end
+
+ def test_server_goaway
+ open_server_connection {|con|
+ con << Frame.headers(3, "", :end_stream, :end_headers).assemble
+ con.goaway(:stream_closed)
+
+ last = sent_frames.last
+ assert_equal(:goaway, last.type)
+ assert_equal([], last.flags)
+ assert_equal(3, last.payload.uint32)
+ assert_equal(ERROR_CODES[:stream_closed], last.payload.uint32(4))
+ }
+ end
+end
diff --git a/test/plum/test_frame_helper.rb b/test/plum/test_frame_utils.rb
index 3a463ab..65cc9d0 100644
--- a/test/plum/test_frame_helper.rb
+++ b/test/plum/test_frame_utils.rb
@@ -1,6 +1,6 @@
require "test_helper"
-class FrameHelperTest < Minitest::Test
+class FrameUtilsTest < Minitest::Test
def test_frame_enough_short
frame = Frame.new(type: :data, stream_id: 1, payload: "123")
ret = frame.split_data(3)