1
0
Fork 0
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:
Rafael França 2017-01-01 15:43:10 -05:00 committed by GitHub
commit 3e8fa248b1

View file

@ -31,11 +31,29 @@ class InflectorTest < ActiveSupport::TestCase
assert_equal "", ActiveSupport::Inflector.pluralize("") assert_equal "", ActiveSupport::Inflector.pluralize("")
end end
def test_pluralize_for_words_with_non_ascii_characters test "uncountability of ascii word" do
word = "HTTP"
ActiveSupport::Inflector.inflections do |inflect| ActiveSupport::Inflector.inflections do |inflect|
inflect.uncountable "" inflect.uncountable word
end 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 ActiveSupport::Inflector.inflections.uncountables.pop
end end
@ -515,12 +533,4 @@ class InflectorTest < ActiveSupport::TestCase
end end
end 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 end