Make the tests for uncountability of ascii and non-ascii words uniform

This commit is contained in:
Prathamesh Sonpatki 2016-12-31 09:28:52 +05:30
parent c3ff36815c
commit 11b6f9e06a
No known key found for this signature in database
GPG Key ID: 8B90F6B89E2BCB71

@ -31,11 +31,29 @@ def test_pluralize_empty_string
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 @@ def test_clear_with_default
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