From 4e7c6f58fb14ad8783062303191eebed7699965b Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Mon, 20 Mar 2006 03:32:28 +0000 Subject: Added option to String#camelize to generate lower-cased camel case by passing in :lower, like "super_man".camelize(:lower) # => "superMan" [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3986 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activesupport/test/inflector_test.rb | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'activesupport/test') diff --git a/activesupport/test/inflector_test.rb b/activesupport/test/inflector_test.rb index 12976a6d92..c0a2b76a5a 100644 --- a/activesupport/test/inflector_test.rb +++ b/activesupport/test/inflector_test.rb @@ -110,7 +110,14 @@ class InflectorTest < Test::Unit::TestCase "Product" => "product", "SpecialGuest" => "special_guest", "ApplicationController" => "application_controller", - "Area51Controller" => "area51_controller", + "Area51Controller" => "area51_controller" + } + + UnderscoreToLowerCamel = { + "product" => "product", + "special_guest" => "specialGuest", + "application_controller" => "applicationController", + "area51_controller" => "area51Controller" } CamelToUnderscoreWithoutReverse = { @@ -308,4 +315,10 @@ class InflectorTest < Test::Unit::TestCase assert_equal(underscored, Inflector.underscore(Inflector.dasherize(underscored))) end end + + def test_underscore_to_lower_camel + UnderscoreToLowerCamel.each do |underscored, lower_camel| + assert_equal(lower_camel, Inflector.camelize(underscored, false)) + end + end end -- cgit v1.2.3