mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #27520 from prathamesh-sonpatki/merge-uncountable-tests-for-inflector
Make the tests for uncountability of ascii and non-ascii words uniform
This commit is contained in:
commit
3e8fa248b1
1 changed files with 21 additions and 11 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue