diff options
Diffstat (limited to 'test/unit/test_response.rb')
-rw-r--r-- | test/unit/test_response.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/unit/test_response.rb b/test/unit/test_response.rb index 17732fe..203ae4d 100644 --- a/test/unit/test_response.rb +++ b/test/unit/test_response.rb @@ -54,5 +54,15 @@ class ResponseTest < Test::Unit::TestCase assert_match(/^X-Whatever: stuff\r\nX-Whatever: bleh\r\n/, out.string) end -end + def test_body_closed + expect_body = %w(1 2 3 4).join("\n") + body = StringIO.new(expect_body) + body.rewind + out = StringIO.new + HttpResponse.write(out,[200, {}, body]) + assert out.closed? + assert body.closed? + assert_match(expect_body, out.string.split(/\r\n/).last) + end +end |