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/controller | |
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/controller')
-rw-r--r-- | actionpack/test/controller/streaming_test.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/actionpack/test/controller/streaming_test.rb b/actionpack/test/controller/streaming_test.rb new file mode 100644 index 0000000000..50c98f220a --- /dev/null +++ b/actionpack/test/controller/streaming_test.rb @@ -0,0 +1,30 @@ +require 'abstract_unit' + +module ActionController + class StreamingResponseTest < ActionController::TestCase + class TestController < ActionController::Base + def self.controller_path + 'test' + end + + def basic_stream + %w{ hello world }.each do |word| + response.stream.write word + response.stream.write "\n" + end + response.stream.close + end + end + + tests TestController + + def test_write_to_stream + get :basic_stream + assert_equal "hello\nworld\n", @response.body + end + + def test_write_after_close + @response.stream + end + end +end |