mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #6806 from chancancode/add_test_singularize_of_irregularity
Inflector: Added missing tests cases to ensure idempotency of singularize and pluralize
This commit is contained in:
commit
682d247ca4
2 changed files with 12 additions and 0 deletions
|
@ -413,6 +413,16 @@ class InflectorTest < ActiveSupport::TestCase
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Irregularities.each do |irregularity|
|
||||||
|
singular, plural = *irregularity
|
||||||
|
ActiveSupport::Inflector.inflections do |inflect|
|
||||||
|
define_method("test_singularize_of_irregularity_#{singular}_should_be_the_same") do
|
||||||
|
inflect.irregular(singular, plural)
|
||||||
|
assert_equal singular, ActiveSupport::Inflector.singularize(singular)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
[ :all, [] ].each do |scope|
|
[ :all, [] ].each do |scope|
|
||||||
ActiveSupport::Inflector.inflections do |inflect|
|
ActiveSupport::Inflector.inflections do |inflect|
|
||||||
define_method("test_clear_inflections_with_#{scope.kind_of?(Array) ? "no_arguments" : scope}") do
|
define_method("test_clear_inflections_with_#{scope.kind_of?(Array) ? "no_arguments" : scope}") do
|
||||||
|
|
|
@ -308,5 +308,7 @@ module InflectorTestCases
|
||||||
'child' => 'children',
|
'child' => 'children',
|
||||||
'sex' => 'sexes',
|
'sex' => 'sexes',
|
||||||
'move' => 'moves',
|
'move' => 'moves',
|
||||||
|
'cow' => 'kine',
|
||||||
|
'zombie' => 'zombies',
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue