diff options
Diffstat (limited to 'activesupport/test/inflector_test.rb')
-rw-r--r-- | activesupport/test/inflector_test.rb | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/activesupport/test/inflector_test.rb b/activesupport/test/inflector_test.rb index 6b7e839e43..7b012f7caa 100644 --- a/activesupport/test/inflector_test.rb +++ b/activesupport/test/inflector_test.rb @@ -4,7 +4,7 @@ require 'active_support/inflector' require 'inflector_test_cases' require 'constantize_test_cases' -class InflectorTest < Test::Unit::TestCase +class InflectorTest < ActiveSupport::TestCase include InflectorTestCases include ConstantizeTestCases @@ -65,6 +65,14 @@ class InflectorTest < Test::Unit::TestCase assert_equal(plural.capitalize, ActiveSupport::Inflector.pluralize(plural.capitalize)) end end + + SingularToPlural.each do |singular, plural| + define_method "test_singularize_singular_#{singular}" do + assert_equal(singular, ActiveSupport::Inflector.singularize(singular)) + assert_equal(singular.capitalize, ActiveSupport::Inflector.singularize(singular.capitalize)) + end + end + def test_overwrite_previous_inflectors assert_equal("series", ActiveSupport::Inflector.singularize("series")) @@ -304,6 +312,12 @@ class InflectorTest < Test::Unit::TestCase def test_ordinal OrdinalNumbers.each do |number, ordinalized| + assert_equal(ordinalized, number + ActiveSupport::Inflector.ordinal(number)) + end + end + + def test_ordinalize + OrdinalNumbers.each do |number, ordinalized| assert_equal(ordinalized, ActiveSupport::Inflector.ordinalize(number)) end end |