class LocalizedTemplatesTest

Public Instance Methods

test_default_locale_template_is_used_when_locale_is_missing() click to toggle source
# File actionpack/test/controller/localized_templates_test.rb, line 27
def test_default_locale_template_is_used_when_locale_is_missing
  I18n.locale = :dk
  get :hello_world
  assert_equal "Hello World", @response.body
end
test_localized_template_has_correct_header_with_no_format_in_template_name() click to toggle source
# File actionpack/test/controller/localized_templates_test.rb, line 42
def test_localized_template_has_correct_header_with_no_format_in_template_name
  I18n.locale = :it
  get :hello_world
  assert_equal "Ciao Mondo", @response.body
  assert_equal "text/html",  @response.content_type
end
test_localized_template_is_used() click to toggle source
# File actionpack/test/controller/localized_templates_test.rb, line 21
def test_localized_template_is_used
  I18n.locale = :de
  get :hello_world
  assert_equal "Guten Tag", @response.body
end
test_use_fallback_locales() click to toggle source
# File actionpack/test/controller/localized_templates_test.rb, line 33
def test_use_fallback_locales
  I18n.locale = :"de-AT"
  I18n.backend.class.include(I18n::Backend::Fallbacks)
  I18n.fallbacks[:"de-AT"] = [:de]

  get :hello_world
  assert_equal "Guten Tag", @response.body
end