Make the tests for uncountability of ascii and non-ascii words uniform
This commit is contained in:
parent
c3ff36815c
commit
11b6f9e06a
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user