aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorNick Cox <nick@nickcox.me>2013-04-10 04:20:36 +0000
committerSteve Klabnik <steve@steveklabnik.com>2013-04-10 04:22:34 +0000
commit8cf88cc75ad0289f39fc2272c372f945b3934e76 (patch)
tree1ebae434bbcb994747f9d311eb9373a1e5c92336 /activesupport/test
parent9039c5038823754f79e04f1e83723e46229dbe05 (diff)
downloadrails-8cf88cc75ad0289f39fc2272c372f945b3934e76.tar.gz
rails-8cf88cc75ad0289f39fc2272c372f945b3934e76.tar.bz2
rails-8cf88cc75ad0289f39fc2272c372f945b3934e76.zip
Fix inflector to respect default locale.
The inflector was made aware of locales in 7db0b073fec6bc3e6f213b58c76e7f43fcc2ab97, but it defaulted to :en. That should actually be our default locale instead. Fixes #10125
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/inflector_test.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/activesupport/test/inflector_test.rb b/activesupport/test/inflector_test.rb
index 22cb61ffd6..ca3dbd9d64 100644
--- a/activesupport/test/inflector_test.rb
+++ b/activesupport/test/inflector_test.rb
@@ -380,6 +380,23 @@ class InflectorTest < ActiveSupport::TestCase
assert !ActiveSupport::Inflector.inflections.plurals.empty?
assert !ActiveSupport::Inflector.inflections.singulars.empty?
end
+
+ def test_inflector_with_default_locale
+ old_locale = I18n.locale
+
+ begin
+ I18n.locale = :de
+
+ ActiveSupport::Inflector.inflections(:de) do |inflect|
+ inflect.irregular 'region', 'regionen'
+ end
+
+ assert_equal('regionen', 'region'.pluralize)
+ assert_equal('region', 'regionen'.singularize)
+ ensure
+ I18n.locale = old_locale
+ end
+ end
def test_clear_all
with_dup do