diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-01-28 15:52:45 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-01-28 15:52:45 +0000 |
commit | b0ed5057e01b78f2f7e0e078c0534647b425c290 (patch) | |
tree | 5f95376c0507f8decd83b76c17de93ed8dfc48e2 /activesupport/test/core_ext | |
parent | 269ad9711ddc179e72cc7da3176893a1dcca1b26 (diff) | |
download | rails-b0ed5057e01b78f2f7e0e078c0534647b425c290.tar.gz rails-b0ed5057e01b78f2f7e0e078c0534647b425c290.tar.bz2 rails-b0ed5057e01b78f2f7e0e078c0534647b425c290.zip |
Full test coverage for Inflector. Closes #7228.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6075 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r-- | activesupport/test/core_ext/string_ext_test.rb | 20 |
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) |