aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/render_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/template/render_test.rb')
-rw-r--r--actionpack/test/template/render_test.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/actionpack/test/template/render_test.rb b/actionpack/test/template/render_test.rb
index 647c673902..c9a50da418 100644
--- a/actionpack/test/template/render_test.rb
+++ b/actionpack/test/template/render_test.rb
@@ -283,7 +283,7 @@ class LazyViewRenderTest < ActiveSupport::TestCase
with_external_encoding Encoding::ASCII_8BIT do
result = @view.render(:file => "test/utf8_magic.html.erb", :layouts => "layouts/yield")
assert_equal Encoding::UTF_8, result.encoding
- assert_equal "Русский текст\nUTF-8\nUTF-8\nUTF-8\n", result
+ assert_equal "Русский текст\n\nUTF-8\nUTF-8\nUTF-8\n", result
end
end
@@ -291,7 +291,7 @@ class LazyViewRenderTest < ActiveSupport::TestCase
with_external_encoding Encoding::UTF_8 do
result = @view.render(:file => "test/utf8.html.erb", :layouts => "layouts/yield")
assert_equal Encoding::UTF_8, result.encoding
- assert_equal "Русский текст\nUTF-8\nUTF-8\nUTF-8\n", result
+ assert_equal "Русский текст\n\nUTF-8\nUTF-8\nUTF-8\n", result
end
end
@@ -306,6 +306,17 @@ class LazyViewRenderTest < ActiveSupport::TestCase
end
end
+ def test_render_utf8_template_with_partial_with_incompatible_encoding
+ with_external_encoding Encoding::SJIS do
+ begin
+ result = @view.render(:file => "test/utf8_magic_with_bare_partial.html.erb", :layouts => "layouts/yield")
+ flunk 'Should have raised incompatible encoding error'
+ rescue ActionView::Template::Error => error
+ assert_match 'invalid byte sequence in Shift_JIS', error.original_exception.message
+ end
+ end
+ end
+
def with_external_encoding(encoding)
old, Encoding.default_external = Encoding.default_external, encoding
yield