aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2010-04-08 18:11:26 -0700
committerCarl Lerche <carllerche@mac.com>2010-04-08 18:11:26 -0700
commit99d54599215c2a8cea7e57f609e8e578043d71b2 (patch)
treead6dd5ac7a65525f3b372d52194b50d035ce1579 /actionpack/test
parent1e3dce08e11bd11e7d774512ea599166c4c45378 (diff)
downloadrails-99d54599215c2a8cea7e57f609e8e578043d71b2.tar.gz
rails-99d54599215c2a8cea7e57f609e8e578043d71b2.tar.bz2
rails-99d54599215c2a8cea7e57f609e8e578043d71b2.zip
Fixed that default locale templates should be used if the current locale template is missing [DHH]
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/controller/localized_templates_test.rb22
-rw-r--r--actionpack/test/fixtures/localized/hello_world.de.html1
-rw-r--r--actionpack/test/fixtures/localized/hello_world.en.html1
3 files changed, 24 insertions, 0 deletions
diff --git a/actionpack/test/controller/localized_templates_test.rb b/actionpack/test/controller/localized_templates_test.rb
new file mode 100644
index 0000000000..41ff2f3809
--- /dev/null
+++ b/actionpack/test/controller/localized_templates_test.rb
@@ -0,0 +1,22 @@
+require 'abstract_unit'
+
+class LocalizedController < ActionController::Base
+ def hello_world
+ end
+end
+
+class LocalizedTemplatesTest < ActionController::TestCase
+ tests LocalizedController
+
+ def test_localized_template_is_used
+ I18n.locale = :de
+ get :hello_world
+ assert_equal "Gutten Tag", @response.body
+ end
+
+ def test_default_locale_template_is_used_when_locale_is_missing
+ I18n.locale = :dk
+ get :hello_world
+ assert_equal "Hello World", @response.body
+ end
+end \ No newline at end of file
diff --git a/actionpack/test/fixtures/localized/hello_world.de.html b/actionpack/test/fixtures/localized/hello_world.de.html
new file mode 100644
index 0000000000..4727d7a7e0
--- /dev/null
+++ b/actionpack/test/fixtures/localized/hello_world.de.html
@@ -0,0 +1 @@
+Gutten Tag \ No newline at end of file
diff --git a/actionpack/test/fixtures/localized/hello_world.en.html b/actionpack/test/fixtures/localized/hello_world.en.html
new file mode 100644
index 0000000000..5e1c309dae
--- /dev/null
+++ b/actionpack/test/fixtures/localized/hello_world.en.html
@@ -0,0 +1 @@
+Hello World \ No newline at end of file