aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2015-07-09 21:24:24 +0200
committerKasper Timm Hansen <kaspth@gmail.com>2015-07-09 21:24:24 +0200
commit87b4f3105f7eaa2db6cbe75ec0e4ee77146552d2 (patch)
tree753241c535e8cb331e446424f1614ece6d457cc9 /actionview/test/template
parent140d5a3b2f2131c7e7184f6792a3d94646c19cc0 (diff)
parentbb851651f19ae91b800c7eff220690d8ca8fc368 (diff)
downloadrails-87b4f3105f7eaa2db6cbe75ec0e4ee77146552d2.tar.gz
rails-87b4f3105f7eaa2db6cbe75ec0e4ee77146552d2.tar.bz2
rails-87b4f3105f7eaa2db6cbe75ec0e4ee77146552d2.zip
Merge pull request #20813 from noniq/locale-argument-for-pluralize-helper
Allow `pluralize` helper to take a locale.
Diffstat (limited to 'actionview/test/template')
-rw-r--r--actionview/test/template/text_helper_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/actionview/test/template/text_helper_test.rb b/actionview/test/template/text_helper_test.rb
index f1b84c4786..5791f33069 100644
--- a/actionview/test/template/text_helper_test.rb
+++ b/actionview/test/template/text_helper_test.rb
@@ -383,6 +383,18 @@ class TextHelperTest < ActionView::TestCase
assert_equal("12 berries", pluralize(12, "berry"))
end
+ def test_pluralization_with_locale
+ ActiveSupport::Inflector.inflections(:de) do |inflect|
+ inflect.plural(/(person)$/i, '\1en')
+ inflect.singular(/(person)en$/i, '\1')
+ end
+
+ assert_equal("2 People", pluralize(2, "Person", locale: :en))
+ assert_equal("2 Personen", pluralize(2, "Person", locale: :de))
+
+ ActiveSupport::Inflector.inflections(:de).clear
+ end
+
def test_cycle_class
value = Cycle.new("one", 2, "3")
assert_equal("one", value.to_s)