aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/localized_templates_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/test/controller/localized_templates_test.rb')
-rw-r--r--actionpack/test/controller/localized_templates_test.rb26
1 files changed, 25 insertions, 1 deletions
diff --git a/actionpack/test/controller/localized_templates_test.rb b/actionpack/test/controller/localized_templates_test.rb
index 41ff2f3809..27871ef351 100644
--- a/actionpack/test/controller/localized_templates_test.rb
+++ b/actionpack/test/controller/localized_templates_test.rb
@@ -8,6 +8,14 @@ end
class LocalizedTemplatesTest < ActionController::TestCase
tests LocalizedController
+ setup do
+ @old_locale = I18n.locale
+ end
+
+ teardown do
+ I18n.locale = @old_locale
+ end
+
def test_localized_template_is_used
I18n.locale = :de
get :hello_world
@@ -19,4 +27,20 @@ class LocalizedTemplatesTest < ActionController::TestCase
get :hello_world
assert_equal "Hello World", @response.body
end
-end \ No newline at end of file
+
+ def test_use_fallback_locales
+ I18n.locale = :"de-AT"
+ I18n.backend.class.send(:include, I18n::Backend::Fallbacks)
+ I18n.fallbacks[:"de-AT"] = [:de]
+
+ get :hello_world
+ assert_equal "Gutten Tag", @response.body
+ end
+
+ 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
+end