From e23554d79e2db2324144f3ab58f82a895b93fbf5 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Thu, 28 May 2009 16:56:09 -0500 Subject: Ruby 1.9: flushing the output buffer preserves its encoding --- actionpack/test/template/output_buffer_test.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/template/output_buffer_test.rb b/actionpack/test/template/output_buffer_test.rb index f1df1c7a60..36bbaf9099 100644 --- a/actionpack/test/template/output_buffer_test.rb +++ b/actionpack/test/template/output_buffer_test.rb @@ -38,6 +38,17 @@ class OutputBufferTest < ActionController::TestCase assert_equal ['foo', 'bar'], body_parts end + if '1.9'.respond_to?(:force_encoding) + test 'flushing preserves output buffer encoding' do + original_buffer = ' '.force_encoding(Encoding::EUC_JP) + @controller.template.output_buffer = original_buffer + @controller.template.flush_output_buffer + assert_equal ['foo', original_buffer], body_parts + assert_not_equal original_buffer, output_buffer + assert_equal Encoding::EUC_JP, output_buffer.encoding + end + end + protected def output_buffer @controller.template.output_buffer -- cgit v1.2.3