aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2012-07-29 17:26:07 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2012-07-29 21:43:05 -0700
commitaf0a9f9eefaee3a8120cfd8d05cbc431af376da3 (patch)
tree3eca858f42bf55c2e1d660434f3e782c524debab /actionpack/test/controller
parentd4433a35215c5e32d5cb91885c4084f849988887 (diff)
downloadrails-af0a9f9eefaee3a8120cfd8d05cbc431af376da3.tar.gz
rails-af0a9f9eefaee3a8120cfd8d05cbc431af376da3.tar.bz2
rails-af0a9f9eefaee3a8120cfd8d05cbc431af376da3.zip
added live responses which can be written and read in separate threads
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/live_stream_test.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/actionpack/test/controller/live_stream_test.rb b/actionpack/test/controller/live_stream_test.rb
new file mode 100644
index 0000000000..6ee6444065
--- /dev/null
+++ b/actionpack/test/controller/live_stream_test.rb
@@ -0,0 +1,26 @@
+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
+ end
+end