class ContentTypeTest
Public Instance Methods
setup()
click to toggle source
Calls superclass method
# File actionpack/test/controller/content_type_test.rb, line 58 def setup super # enable a logger so that (e.g.) the benchmarking stuff runs, so we can get # a more accurate simulation of what happens in "real life". @controller.logger = ActiveSupport::Logger.new(nil) end
test_change_for_builder()
click to toggle source
# File actionpack/test/controller/content_type_test.rb, line 128 def test_change_for_builder get :render_change_for_builder assert_equal Mime[:html], @response.content_type assert_equal "utf-8", @response.charset end
test_charset_from_body()
click to toggle source
:ported:
# File actionpack/test/controller/content_type_test.rb, line 95 def test_charset_from_body get :render_charset_from_body assert_equal Mime[:text], @response.content_type assert_equal "utf-16", @response.charset end
test_content_type_from_body()
click to toggle source
:ported:
# File actionpack/test/controller/content_type_test.rb, line 81 def test_content_type_from_body get :render_content_type_from_body assert_equal Mime[:rss], @response.content_type assert_equal "utf-8", @response.charset end
test_content_type_from_render()
click to toggle source
:ported:
# File actionpack/test/controller/content_type_test.rb, line 88 def test_content_type_from_render get :render_content_type_from_render assert_equal Mime[:rss], @response.content_type assert_equal "utf-8", @response.charset end
test_default_for_builder()
click to toggle source
# File actionpack/test/controller/content_type_test.rb, line 122 def test_default_for_builder get :render_default_for_builder assert_equal Mime[:xml], @response.content_type assert_equal "utf-8", @response.charset end
test_default_for_erb()
click to toggle source
# File actionpack/test/controller/content_type_test.rb, line 116 def test_default_for_erb get :render_default_for_erb assert_equal Mime[:html], @response.content_type assert_equal "utf-8", @response.charset end
test_nil_charset_from_body()
click to toggle source
:ported:
# File actionpack/test/controller/content_type_test.rb, line 102 def test_nil_charset_from_body get :render_nil_charset_from_body assert_equal Mime[:text], @response.content_type assert_equal "utf-8", @response.charset, @response.headers.inspect end
test_nil_default_for_erb()
click to toggle source
# File actionpack/test/controller/content_type_test.rb, line 108 def test_nil_default_for_erb with_default_charset nil do get :render_default_for_erb assert_equal Mime[:html], @response.content_type assert_nil @response.charset, @response.headers.inspect end end
test_render_changed_charset_default()
click to toggle source
# File actionpack/test/controller/content_type_test.rb, line 72 def test_render_changed_charset_default with_default_charset "utf-16" do get :render_defaults assert_equal "utf-16", @response.charset assert_equal Mime[:text], @response.content_type end end
test_render_defaults()
click to toggle source
:ported:
# File actionpack/test/controller/content_type_test.rb, line 66 def test_render_defaults get :render_defaults assert_equal "utf-8", @response.charset assert_equal Mime[:text], @response.content_type end
Private Instance Methods
with_default_charset(charset) { || ... }
click to toggle source
# File actionpack/test/controller/content_type_test.rb, line 136 def with_default_charset(charset) old_default_charset = ActionDispatch::Response.default_charset ActionDispatch::Response.default_charset = charset yield ensure ActionDispatch::Response.default_charset = old_default_charset end