aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/string_ext_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test/core_ext/string_ext_test.rb')
-rw-r--r--activesupport/test/core_ext/string_ext_test.rb20
1 files changed, 19 insertions, 1 deletions
diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb
index 7eff505a22..cd2d12c3b1 100644
--- a/activesupport/test/core_ext/string_ext_test.rb
+++ b/activesupport/test/core_ext/string_ext_test.rb
@@ -16,6 +16,12 @@ class StringInflectionsTest < Test::Unit::TestCase
end
end
+ def test_titleize
+ InflectorTest::MixtureToTitleCase.each do |before, titleized|
+ assert_equal(titleized, before.titleize)
+ end
+ end
+
def test_camelize
InflectorTest::CamelToUnderscore.each do |camel, underscore|
assert_equal(camel, underscore.camelize)
@@ -31,8 +37,14 @@ class StringInflectionsTest < Test::Unit::TestCase
assert_equal "html_tidy_generator", "HTMLTidyGenerator".underscore
end
+ def test_underscore_to_lower_camel
+ InflectorTest::UnderscoreToLowerCamel.each do |underscored, lower_camel|
+ assert_equal(lower_camel, underscored.camelize(:lower))
+ end
+ end
+
def test_demodulize
- assert_equal "Account", Inflector.demodulize("MyApplication::Billing::Account")
+ assert_equal "Account", "MyApplication::Billing::Account".demodulize
end
def test_foreign_key
@@ -57,6 +69,12 @@ class StringInflectionsTest < Test::Unit::TestCase
end
end
+ def test_humanize
+ InflectorTest::UnderscoreToHuman.each do |underscore, human|
+ assert_equal(human, underscore.humanize)
+ end
+ end
+
def test_string_to_time
assert_equal Time.utc(2005, 2, 27, 23, 50), "2005-02-27 23:50".to_time
assert_equal Time.local(2005, 2, 27, 23, 50), "2005-02-27 23:50".to_time(:local)