diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-06-21 05:35:31 -0700 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-06-21 05:35:31 -0700 |
commit | 682d247ca4a273e590e7ffd915e6463fab4f016e (patch) | |
tree | bae5a401b04247730e8624c2c59b10ea491df760 | |
parent | e769559a93d8cb379ff08ce36c72535671340fb2 (diff) | |
parent | fe933be5e20363c21c7989172fab5844ea8abd68 (diff) | |
download | rails-682d247ca4a273e590e7ffd915e6463fab4f016e.tar.gz rails-682d247ca4a273e590e7ffd915e6463fab4f016e.tar.bz2 rails-682d247ca4a273e590e7ffd915e6463fab4f016e.zip |
Merge pull request #6806 from chancancode/add_test_singularize_of_irregularity
Inflector: Added missing tests cases to ensure idempotency of singularize and pluralize
-rw-r--r-- | activesupport/test/inflector_test.rb | 10 | ||||
-rw-r--r-- | activesupport/test/inflector_test_cases.rb | 2 |
2 files changed, 12 insertions, 0 deletions
diff --git a/activesupport/test/inflector_test.rb b/activesupport/test/inflector_test.rb index 91ae6bc189..1f32e4ff92 100644 --- a/activesupport/test/inflector_test.rb +++ b/activesupport/test/inflector_test.rb @@ -413,6 +413,16 @@ class InflectorTest < ActiveSupport::TestCase 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 diff --git a/activesupport/test/inflector_test_cases.rb b/activesupport/test/inflector_test_cases.rb index 9fa1f417e4..ca4efd2e59 100644 --- a/activesupport/test/inflector_test_cases.rb +++ b/activesupport/test/inflector_test_cases.rb @@ -308,5 +308,7 @@ module InflectorTestCases 'child' => 'children', 'sex' => 'sexes', 'move' => 'moves', + 'cow' => 'kine', + 'zombie' => 'zombies', } end |