diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-03-13 03:23:13 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-03-13 03:23:13 -0700 |
commit | 2f998fc81fd3525e4f19ba55937ee423c4b71856 (patch) | |
tree | e61e3c654c0a81dd282fa0d88ca5ad8d999d5540 | |
parent | b2f98c13a3308e6db618d6f3f9f706cbc19f13fd (diff) | |
download | rails-2f998fc81fd3525e4f19ba55937ee423c4b71856.tar.gz rails-2f998fc81fd3525e4f19ba55937ee423c4b71856.tar.bz2 rails-2f998fc81fd3525e4f19ba55937ee423c4b71856.zip |
Extract output buffer test
-rw-r--r-- | actionpack/test/template/body_parts_test.rb | 34 | ||||
-rw-r--r-- | actionpack/test/template/output_buffer_test.rb | 35 |
2 files changed, 35 insertions, 34 deletions
diff --git a/actionpack/test/template/body_parts_test.rb b/actionpack/test/template/body_parts_test.rb index 4555a6b015..aece24635c 100644 --- a/actionpack/test/template/body_parts_test.rb +++ b/actionpack/test/template/body_parts_test.rb @@ -2,40 +2,6 @@ require 'abstract_unit' require 'action_view/body_parts/queued' require 'action_view/body_parts/threaded' -class OutputBufferTest < ActionController::TestCase - class TestController < ActionController::Base - def index - render :text => 'foo' - end - end - - tests TestController - - def test_flush_output_buffer - # Start with the default body parts - get :index - assert_equal ['foo'], @response.body_parts - assert_nil @response.template.output_buffer - - # Nil output buffer is skipped - @response.template.flush_output_buffer - assert_nil @response.template.output_buffer - assert_equal ['foo'], @response.body_parts - - # Empty output buffer is skipped - @response.template.output_buffer = '' - @response.template.flush_output_buffer - assert_equal '', @response.template.output_buffer - assert_equal ['foo'], @response.body_parts - - # Flushing appends the output buffer to the body parts - @response.template.output_buffer = 'bar' - @response.template.flush_output_buffer - assert_equal '', @response.template.output_buffer - assert_equal ['foo', 'bar'], @response.body_parts - end -end - class QueuedPartTest < ActionController::TestCase class EdgeSideInclude < ActionView::BodyParts::Queued diff --git a/actionpack/test/template/output_buffer_test.rb b/actionpack/test/template/output_buffer_test.rb new file mode 100644 index 0000000000..6d8eab63dc --- /dev/null +++ b/actionpack/test/template/output_buffer_test.rb @@ -0,0 +1,35 @@ +require 'abstract_unit' + +class OutputBufferTest < ActionController::TestCase + class TestController < ActionController::Base + def index + render :text => 'foo' + end + end + + tests TestController + + def test_flush_output_buffer + # Start with the default body parts + get :index + assert_equal ['foo'], @response.body_parts + assert_nil @response.template.output_buffer + + # Nil output buffer is skipped + @response.template.flush_output_buffer + assert_nil @response.template.output_buffer + assert_equal ['foo'], @response.body_parts + + # Empty output buffer is skipped + @response.template.output_buffer = '' + @response.template.flush_output_buffer + assert_equal '', @response.template.output_buffer + assert_equal ['foo'], @response.body_parts + + # Flushing appends the output buffer to the body parts + @response.template.output_buffer = 'bar' + @response.template.flush_output_buffer + assert_equal '', @response.template.output_buffer + assert_equal ['foo', 'bar'], @response.body_parts + end +end |