diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-03-26 13:20:47 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-03-26 13:20:47 +0000 |
commit | abfa14d825c8eeb8e1ba33b6c9168445ec48f248 (patch) | |
tree | c7f3a4164e37d6f46f5bb2b1b4c6268768bf662d /activesupport/test | |
parent | 87b1d3834f135390375f2fa06e9b2a22ade0b5cb (diff) | |
download | rails-abfa14d825c8eeb8e1ba33b6c9168445ec48f248.tar.gz rails-abfa14d825c8eeb8e1ba33b6c9168445ec48f248.tar.bz2 rails-abfa14d825c8eeb8e1ba33b6c9168445ec48f248.zip |
Fixed Inflector.pluralize to handle capitalized words #932 [bitsweat]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@998 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/inflector_test.rb | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/activesupport/test/inflector_test.rb b/activesupport/test/inflector_test.rb index 14a532a9a2..ffadb5bd96 100644 --- a/activesupport/test/inflector_test.rb +++ b/activesupport/test/inflector_test.rb @@ -17,9 +17,9 @@ class InflectorTest < Test::Unit::TestCase "process" => "processes", "address" => "addresses", "case" => "cases", - "stack" => "stacks",
- "wish" => "wishes",
- "fish" => "fish", + "stack" => "stacks", + "wish" => "wishes", + "fish" => "fish", "category" => "categories", "query" => "queries", @@ -92,17 +92,22 @@ class InflectorTest < Test::Unit::TestCase "underground" => "Underground" } - def test_pluralize - SingularToPlural.each do |singular, plural| + def test_pluralize_plurals + assert_equal "plurals", Inflector.pluralize("plurals") + assert_equal "Plurals", Inflector.pluralize("Plurals") + end + + SingularToPlural.each do |singular, plural| + define_method "test_pluralize_#{singular}" do assert_equal(plural, Inflector.pluralize(singular)) + assert_equal(plural.capitalize, Inflector.pluralize(singular.capitalize)) end - - assert_equal("plurals", Inflector.pluralize("plurals")) end - def test_singularize - SingularToPlural.each do |singular, plural| + SingularToPlural.each do |singular, plural| + define_method "test_singularize_#{plural}" do assert_equal(singular, Inflector.singularize(plural)) + assert_equal(singular.capitalize, Inflector.singularize(plural.capitalize)) end end |