Update to Rails 2.3.8
This commit is contained in:
parent
6677b46cb4
commit
f0635301aa
429 changed files with 17683 additions and 4047 deletions
|
@ -247,14 +247,6 @@ module RenderTestCases
|
|||
assert_equal %(<title>title</title>\n<div id="column">column</div>\n<div id="content">content</div>\n),
|
||||
@view.render(:file => "test/nested_layout.erb", :layout => "layouts/yield")
|
||||
end
|
||||
|
||||
if '1.9'.respond_to?(:force_encoding)
|
||||
def test_render_utf8_template
|
||||
result = @view.render(:file => "test/utf8.html.erb", :layouts => "layouts/yield")
|
||||
assert_equal "Русский текст\n日本語のテキスト", result
|
||||
assert_equal Encoding::UTF_8, result.encoding
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module TemplatesSetupTeardown
|
||||
|
@ -286,5 +278,52 @@ class ReloadableRenderTest < Test::Unit::TestCase
|
|||
def setup
|
||||
setup_view_paths_for(cache_templates = false)
|
||||
end
|
||||
|
||||
if '1.9'.respond_to?(:force_encoding)
|
||||
def test_render_utf8_template_with_magic_comment
|
||||
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 "Русский текст\n\nUTF-8\nUTF-8\nUTF-8\n", result
|
||||
end
|
||||
end
|
||||
|
||||
def test_render_utf8_template_with_default_external_encoding
|
||||
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 "Русский текст\n\nUTF-8\nUTF-8\nUTF-8\n", result
|
||||
end
|
||||
end
|
||||
|
||||
def test_render_utf8_template_with_incompatible_external_encoding
|
||||
with_external_encoding Encoding::SJIS do
|
||||
begin
|
||||
result = @view.render(:file => "test/utf8.html.erb", :layouts => "layouts/yield")
|
||||
flunk 'Should have raised incompatible encoding error'
|
||||
rescue ActionView::TemplateError => error
|
||||
assert_match 'invalid byte sequence in Shift_JIS', error.original_exception.message
|
||||
end
|
||||
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::TemplateError => 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
|
||||
ensure
|
||||
Encoding.default_external = old
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue