aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/output_buffer_test.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2009-05-28 16:55:05 -0500
committerJeremy Kemper <jeremy@bitsweat.net>2009-05-28 17:12:48 -0500
commitd120f9de7e150ea6a5f21c834c1f1d0a9ea25d1a (patch)
tree8f410f9c6eb0f422f1e4bfd3df9684bb2aa495b1 /actionpack/test/template/output_buffer_test.rb
parentcf3ccd7be0caae67dfddf5bc5056dcfdaab6f369 (diff)
downloadrails-d120f9de7e150ea6a5f21c834c1f1d0a9ea25d1a.tar.gz
rails-d120f9de7e150ea6a5f21c834c1f1d0a9ea25d1a.tar.bz2
rails-d120f9de7e150ea6a5f21c834c1f1d0a9ea25d1a.zip
Reinstate pending output buffer tests
Diffstat (limited to 'actionpack/test/template/output_buffer_test.rb')
-rw-r--r--actionpack/test/template/output_buffer_test.rb64
1 files changed, 36 insertions, 28 deletions
diff --git a/actionpack/test/template/output_buffer_test.rb b/actionpack/test/template/output_buffer_test.rb
index 171cfb63e1..f1df1c7a60 100644
--- a/actionpack/test/template/output_buffer_test.rb
+++ b/actionpack/test/template/output_buffer_test.rb
@@ -9,33 +9,41 @@ class OutputBufferTest < ActionController::TestCase
tests TestController
- def test_flush_output_buffer
- pending
- # TODO: This tests needs to be rewritten due
- # The @response is not the same response object assigned
- # to the @controller.template
-
- # Start with the default body parts
- # ---
- # get :index
- # assert_equal ['foo'], @response.body_parts
- # assert_nil @controller.template.output_buffer
- #
- # # Nil output buffer is skipped
- # @controller.template.flush_output_buffer
- # assert_nil @controller.template.output_buffer
- # assert_equal ['foo'], @response.body_parts
- #
- # # Empty output buffer is skipped
- # @controller.template.output_buffer = ''
- # @controller.template.flush_output_buffer
- # assert_equal '', @controller.template.output_buffer
- # assert_equal ['foo'], @response.body_parts
- #
- # # Flushing appends the output buffer to the body parts
- # @controller.template.output_buffer = 'bar'
- # @controller.template.flush_output_buffer
- # assert_equal '', @controller.template.output_buffer
- # assert_equal ['foo', 'bar'], @response.body_parts
+ def setup
+ get :index
+ assert_equal ['foo'], body_parts
end
+
+ test 'output buffer is nil after rendering' do
+ assert_nil output_buffer
+ end
+
+ test 'flushing ignores nil output buffer' do
+ @controller.template.flush_output_buffer
+ assert_nil output_buffer
+ assert_equal ['foo'], body_parts
+ end
+
+ test 'flushing ignores empty output buffer' do
+ @controller.template.output_buffer = ''
+ @controller.template.flush_output_buffer
+ assert_equal '', output_buffer
+ assert_equal ['foo'], body_parts
+ end
+
+ test 'flushing appends the output buffer to the body parts' do
+ @controller.template.output_buffer = 'bar'
+ @controller.template.flush_output_buffer
+ assert_equal '', output_buffer
+ assert_equal ['foo', 'bar'], body_parts
+ end
+
+ protected
+ def output_buffer
+ @controller.template.output_buffer
+ end
+
+ def body_parts
+ @controller.template.response.body_parts
+ end
end