Skip to content
Browse files

Extract output buffer test

  • Loading branch information...
1 parent b2f98c1 commit 2f998fc81fd3525e4f19ba55937ee423c4b71856 @jeremy jeremy committed Mar 13, 2009
Showing with 35 additions and 34 deletions.
  1. +0 −34 actionpack/test/template/body_parts_test.rb
  2. +35 −0 actionpack/test/template/output_buffer_test.rb
View
34 actionpack/test/template/body_parts_test.rb
@@ -2,40 +2,6 @@
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
View
35 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

0 comments on commit 2f998fc

Please sign in to comment.
Something went wrong with that request. Please try again.