aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2017-01-01 15:43:10 -0500
committerGitHub <noreply@github.com>2017-01-01 15:43:10 -0500
commit3e8fa248b194c221e931d646d3eceb59990e90eb (patch)
tree6c597a1cb1f6a72af4b95ccdeed09c7c5b56e7a3 /activesupport
parentfd9a583cf9d3424ec2437fd7527d0ff34d309de0 (diff)
parent11b6f9e06ae48dcdab30dc09634a276ae2707889 (diff)
downloadrails-3e8fa248b194c221e931d646d3eceb59990e90eb.tar.gz
rails-3e8fa248b194c221e931d646d3eceb59990e90eb.tar.bz2
rails-3e8fa248b194c221e931d646d3eceb59990e90eb.zip
Merge pull request #27520 from prathamesh-sonpatki/merge-uncountable-tests-for-inflector
Make the tests for uncountability of ascii and non-ascii words uniform
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/test/inflector_test.rb32
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