Methods
- S
- T
- W
Included Modules
Instance Public methods
setup()
Link
Test the same thing as above, but make sure the view path is not eager loaded
# File actionview/test/template/render_test.rb, line 596 def setup path = ActionView::FileSystemResolver.new(FIXTURE_LOAD_PATH) view_paths = ActionView::PathSet.new([path]) assert_equal ActionView::FileSystemResolver.new(FIXTURE_LOAD_PATH), view_paths.first setup_view(view_paths) end
teardown()
Link
test_render_utf8_template_with_default_external_encoding()
Link
# File actionview/test/template/render_test.rb, line 616 def test_render_utf8_template_with_default_external_encoding with_external_encoding Encoding::UTF_8 do result = @view.render(:file => "test/utf8", :formats => [:html], :layouts => "layouts/yield") assert_equal Encoding::UTF_8, result.encoding assert_equal "Русский текст\n\nUTF-8\nUTF-8\nUTF-8\n", result end end
test_render_utf8_template_with_incompatible_external_encoding()
Link
# File actionview/test/template/render_test.rb, line 624 def test_render_utf8_template_with_incompatible_external_encoding with_external_encoding Encoding::SHIFT_JIS do e = assert_raises(ActionView::Template::Error) { @view.render(:file => "test/utf8", :formats => [:html], :layouts => "layouts/yield") } assert_match 'Your template was not saved as valid Shift_JIS', e.cause.message end end
test_render_utf8_template_with_magic_comment()
Link
# File actionview/test/template/render_test.rb, line 608 def test_render_utf8_template_with_magic_comment with_external_encoding Encoding::ASCII_8BIT do result = @view.render(:file => "test/utf8_magic", :formats => [:html], :layouts => "layouts/yield") assert_equal Encoding::UTF_8, result.encoding assert_equal "\nРусский \nтекст\n\nUTF-8\nUTF-8\nUTF-8\n", result end end
test_render_utf8_template_with_partial_with_incompatible_encoding()
Link
# File actionview/test/template/render_test.rb, line 631 def test_render_utf8_template_with_partial_with_incompatible_encoding with_external_encoding Encoding::SHIFT_JIS do e = assert_raises(ActionView::Template::Error) { @view.render(:file => "test/utf8_magic_with_bare_partial", :formats => [:html], :layouts => "layouts/yield") } assert_match 'Your template was not saved as valid Shift_JIS', e.cause.message end end
with_external_encoding(encoding)
Link