From 381210daa0b8db26be85841b8ccf889d0ef67d75 Mon Sep 17 00:00:00 2001 From: Amos King Date: Fri, 22 Aug 2008 13:31:13 +0100 Subject: camelize(:lower) should always downcase first character. [#696 state:resolved] Signed-off-by: Pratik Naik --- activesupport/test/inflector_test.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activesupport/test/inflector_test.rb') diff --git a/activesupport/test/inflector_test.rb b/activesupport/test/inflector_test.rb index 6c0c14e866..b2fad4a9bc 100644 --- a/activesupport/test/inflector_test.rb +++ b/activesupport/test/inflector_test.rb @@ -46,6 +46,10 @@ class InflectorTest < Test::Unit::TestCase end end + def test_camelize_with_lower_downcases_the_first_letter + assert_equal('capital', ActiveSupport::Inflector.camelize('Capital', false)) + end + def test_underscore CamelToUnderscore.each do |camel, underscore| assert_equal(underscore, ActiveSupport::Inflector.underscore(camel)) -- cgit v1.2.3 From a652c300ac9d60f6420d1cf86632f6a3c4ceef17 Mon Sep 17 00:00:00 2001 From: Peter Wagenet Date: Sat, 23 Aug 2008 13:33:07 -0400 Subject: New inflectors will overwrite defaults [#337 state:resolved] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tarmo Tänav --- activesupport/test/inflector_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'activesupport/test/inflector_test.rb') diff --git a/activesupport/test/inflector_test.rb b/activesupport/test/inflector_test.rb index b2fad4a9bc..8eebe1be25 100644 --- a/activesupport/test/inflector_test.rb +++ b/activesupport/test/inflector_test.rb @@ -34,6 +34,13 @@ class InflectorTest < Test::Unit::TestCase end end + def test_overwrite_previous_inflectors + assert_equal("series", ActiveSupport::Inflector.singularize("series")) + ActiveSupport::Inflector.inflections.singular "series", "serie" + assert_equal("serie", ActiveSupport::Inflector.singularize("series")) + ActiveSupport::Inflector.inflections.uncountable "series" # Return to normal + end + MixtureToTitleCase.each do |before, titleized| define_method "test_titleize_#{before}" do assert_equal(titleized, ActiveSupport::Inflector.titleize(before)) -- cgit v1.2.3