diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-17 19:53:42 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-17 19:53:42 +0000 |
commit | 1b38c5523ecff17d4d78181db0fad1a74567c776 (patch) | |
tree | 1671abfe3831d19a6894d065dd7e6e7aa3c270cd /activesupport/test | |
parent | ecfe77f38d21779af96bc9b8f876c15620151d6a (diff) | |
download | rails-1b38c5523ecff17d4d78181db0fad1a74567c776.tar.gz rails-1b38c5523ecff17d4d78181db0fad1a74567c776.tar.bz2 rails-1b38c5523ecff17d4d78181db0fad1a74567c776.zip |
Added Inflector.humanize to turn attribute names like employee_salary into "Employee salary". Used by automated error reporting in AR.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@449 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/inflector_test.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/activesupport/test/inflector_test.rb b/activesupport/test/inflector_test.rb index 41b5f909bb..4523430ebe 100644 --- a/activesupport/test/inflector_test.rb +++ b/activesupport/test/inflector_test.rb @@ -65,6 +65,11 @@ class InflectorTest < Test::Unit::TestCase "PrimarySpokesman" => "primary_spokesmen", "NodeChild" => "node_children" } + + UnderscoreToHuman = { + "employee_salary" => "Employee salary", + "underground" => "Underground" + } def test_pluralize SingularToPlural.each do |singular, plural| @@ -120,4 +125,10 @@ class InflectorTest < Test::Unit::TestCase assert_equal(class_name, Inflector.classify(table_name)) end end + + def test_humanize + UnderscoreToHuman.each do |underscore, human| + assert_equal(human, Inflector.humanize(underscore)) + end + end end
\ No newline at end of file |