diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2016-05-08 02:01:11 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2016-05-08 15:17:15 +0900 |
commit | 30a6b4df628937e4905b5932d4e43e1708332b62 (patch) | |
tree | a77adc1c538f78918376ff126182969bcddbe49f /test/plum | |
parent | 4e67368773d4343ea953518f26af92110e4ccd2d (diff) | |
download | plum-30a6b4df628937e4905b5932d4e43e1708332b62.tar.gz |
client: make Response's internal methods private
And use Object#send to call them. Since they are internal, there should
be no problem.
Diffstat (limited to 'test/plum')
-rw-r--r-- | test/plum/client/test_response.rb | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/test/plum/client/test_response.rb b/test/plum/client/test_response.rb index 511a073..d3d4e42 100644 --- a/test/plum/client/test_response.rb +++ b/test/plum/client/test_response.rb @@ -4,49 +4,49 @@ using Plum::BinaryString class ResponseTest < Minitest::Test def test_finished resp = Response.new - resp._headers({}) + resp.send(:set_headers, {}) assert_equal(false, resp.finished?) - resp._finish + resp.send(:finish) assert_equal(true, resp.finished?) end def test_fail resp = Response.new - resp._fail - assert(true, resp.failed?) + resp.send(:fail, true) + assert(resp.failed?, "response must be failed") end def test_status resp = Response.new - resp._headers([ - [":status", "200"] - ]) + resp.send(:set_headers, + ":status" => "200" + ) assert_equal("200", resp.status) end def test_headers resp = Response.new - resp._headers([ - [":status", "200"], - ["header", "abc"] - ]) + resp.send(:set_headers, + ":status" => "200", + "header" => "abc" + ) assert_equal("abc", resp[:HEADER]) end def test_body resp = Response.new - resp._headers({}) - resp._chunk("a") - resp._chunk("b") - resp._finish + resp.send(:set_headers, {}) + resp.send(:add_chunk, "a") + resp.send(:add_chunk, "b") + resp.send(:finish) assert_equal("ab", resp.body) end def test_body_not_finished resp = Response.new - resp._headers({}) - resp._chunk("a") - resp._chunk("b") + resp.send(:set_headers, {}) + resp.send(:add_chunk, "a") + resp.send(:add_chunk, "b") assert_raises { # TODO resp.body } @@ -54,23 +54,23 @@ class ResponseTest < Minitest::Test def test_on_chunk resp = Response.new - resp._headers({}) + resp.send(:set_headers, {}) res = [] - resp._chunk("a") - resp._chunk("b") - resp._finish + resp.send(:add_chunk, "a") + resp.send(:add_chunk, "b") + resp.send(:finish) resp.on_chunk { |chunk| res << chunk } assert_equal(["a", "b"], res) - resp._chunk("c") + resp.send(:add_chunk, "c") assert_equal(["a", "b", "c"], res) end def test_on_finish resp = Response.new - resp._headers({}) + resp.send(:set_headers, {}) ran = false resp.on_finish { ran = true } - resp._finish + resp.send(:finish) assert(ran) ran = false resp.on_finish { ran = true } |