diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-07-29 15:51:21 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-07-29 15:51:21 -0700 |
commit | 356787fce80ba545e288f464450483d52782871a (patch) | |
tree | 53736c756b5383806b78fadb834adb3a18892504 /actionpack/test/dispatch | |
parent | 76d75f42409a5711a772d78f67cb635b9b1e933a (diff) | |
download | rails-356787fce80ba545e288f464450483d52782871a.tar.gz rails-356787fce80ba545e288f464450483d52782871a.tar.bz2 rails-356787fce80ba545e288f464450483d52782871a.zip |
adding a buffered stream to the response object
Diffstat (limited to 'actionpack/test/dispatch')
-rw-r--r-- | actionpack/test/dispatch/response_test.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/actionpack/test/dispatch/response_test.rb b/actionpack/test/dispatch/response_test.rb index 51948a623c..e2903d4b36 100644 --- a/actionpack/test/dispatch/response_test.rb +++ b/actionpack/test/dispatch/response_test.rb @@ -14,6 +14,26 @@ class ResponseTest < ActiveSupport::TestCase assert t.join(0.5) end + def test_stream_close + @response.stream.close + assert @response.stream.closed? + end + + def test_stream_write + @response.stream.write "foo" + @response.stream.close + assert_equal "foo", @response.body + end + + def test_write_after_close + @response.stream.close + + e = assert_raises(IOError) do + @response.stream.write "omg" + end + assert_equal "closed stream", e.message + end + def test_response_body_encoding body = ["hello".encode('utf-8')] response = ActionDispatch::Response.new 200, {}, body |