From 356787fce80ba545e288f464450483d52782871a Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Sun, 29 Jul 2012 15:51:21 -0700 Subject: adding a buffered stream to the response object --- actionpack/test/controller/streaming_test.rb | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 actionpack/test/controller/streaming_test.rb (limited to 'actionpack/test/controller') 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 -- cgit v1.2.3