diff options
author | Prathamesh Sonpatki <csonpatki@gmail.com> | 2016-12-31 09:28:52 +0530 |
---|---|---|
committer | Prathamesh Sonpatki <csonpatki@gmail.com> | 2016-12-31 09:51:43 +0530 |
commit | 11b6f9e06ae48dcdab30dc09634a276ae2707889 (patch) | |
tree | 2c07a8e2564723f8c4d6c9e4efa4777903f0e71b /activesupport/test | |
parent | c3ff36815c542fac25b2da4e3cff320499b60998 (diff) | |
download | rails-11b6f9e06ae48dcdab30dc09634a276ae2707889.tar.gz rails-11b6f9e06ae48dcdab30dc09634a276ae2707889.tar.bz2 rails-11b6f9e06ae48dcdab30dc09634a276ae2707889.zip |
Make the tests for uncountability of ascii and non-ascii words uniform
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/inflector_test.rb | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/activesupport/test/inflector_test.rb b/activesupport/test/inflector_test.rb index b054e41a79..8d39303f9b 100644 --- a/activesupport/test/inflector_test.rb +++ b/activesupport/test/inflector_test.rb @@ -31,11 +31,29 @@ class InflectorTest < ActiveSupport::TestCase assert_equal "", ActiveSupport::Inflector.pluralize("") end - def test_pluralize_for_words_with_non_ascii_characters + test "uncountability of ascii word" do + word = "HTTP" ActiveSupport::Inflector.inflections do |inflect| - inflect.uncountable "猫" + inflect.uncountable word end - assert_equal "猫", ActiveSupport::Inflector.pluralize("猫") + + assert_equal word, ActiveSupport::Inflector.pluralize(word) + assert_equal word, ActiveSupport::Inflector.singularize(word) + assert_equal ActiveSupport::Inflector.pluralize(word), ActiveSupport::Inflector.singularize(word) + + ActiveSupport::Inflector.inflections.uncountables.pop + end + + test "uncountability of non-ascii word" do + word = "猫" + ActiveSupport::Inflector.inflections do |inflect| + inflect.uncountable word + end + + assert_equal word, ActiveSupport::Inflector.pluralize(word) + assert_equal word, ActiveSupport::Inflector.singularize(word) + assert_equal ActiveSupport::Inflector.pluralize(word), ActiveSupport::Inflector.singularize(word) + ActiveSupport::Inflector.inflections.uncountables.pop end @@ -515,12 +533,4 @@ class InflectorTest < ActiveSupport::TestCase end end end - - def test_inflections_with_uncountable_words - ActiveSupport::Inflector.inflections do |inflect| - inflect.uncountable "HTTP" - end - - assert_equal "HTTP", ActiveSupport::Inflector.pluralize("HTTP") - end end |