Permalink
Browse files

Merge pull request #6806 from chancancode/add_test_singularize_of_irr…

…egularity

Inflector: Added missing tests cases to ensure idempotency of singularize and pluralize
  • Loading branch information...
2 parents e769559 + fe933be commit 682d247ca4a273e590e7ffd915e6463fab4f016e @carlosantoniodasilva carlosantoniodasilva committed Jun 21, 2012
Showing with 12 additions and 0 deletions.
  1. +10 −0 activesupport/test/inflector_test.rb
  2. +2 −0 activesupport/test/inflector_test_cases.rb
@@ -413,6 +413,16 @@ def test_clear_with_default
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|
ActiveSupport::Inflector.inflections do |inflect|
define_method("test_clear_inflections_with_#{scope.kind_of?(Array) ? "no_arguments" : scope}") do
@@ -308,5 +308,7 @@ module InflectorTestCases
'child' => 'children',
'sex' => 'sexes',
'move' => 'moves',
+ 'cow' => 'kine',
+ 'zombie' => 'zombies',
}
end

0 comments on commit 682d247

Please sign in to comment.