aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/string_ext_test.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-09-27 10:19:48 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-09-27 10:19:48 +0000
commitdb9b2f5c228289b3da82d231b985c910e12d969c (patch)
tree3e641afa1e6b505aa16c2560d66daddbf50b13c7 /activesupport/test/core_ext/string_ext_test.rb
parent935f8215371d68f36950c709061e5876ecadaa89 (diff)
downloadrails-db9b2f5c228289b3da82d231b985c910e12d969c.tar.gz
rails-db9b2f5c228289b3da82d231b985c910e12d969c.tar.bz2
rails-db9b2f5c228289b3da82d231b985c910e12d969c.zip
Extract InflectorTestCases so both inflector and string inflections tests can use them.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@7655 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test/core_ext/string_ext_test.rb')
-rw-r--r--activesupport/test/core_ext/string_ext_test.rb25
1 files changed, 14 insertions, 11 deletions
diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb
index b588fadf4f..734974956b 100644
--- a/activesupport/test/core_ext/string_ext_test.rb
+++ b/activesupport/test/core_ext/string_ext_test.rb
@@ -1,9 +1,12 @@
require 'date'
require File.dirname(__FILE__) + '/../abstract_unit'
+require 'inflector_test_cases'
class StringInflectionsTest < Test::Unit::TestCase
+ include InflectorTestCases
+
def test_pluralize
- InflectorTest::SingularToPlural.each do |singular, plural|
+ SingularToPlural.each do |singular, plural|
assert_equal(plural, singular.pluralize)
end
@@ -11,25 +14,25 @@ class StringInflectionsTest < Test::Unit::TestCase
end
def test_singularize
- InflectorTest::SingularToPlural.each do |singular, plural|
+ SingularToPlural.each do |singular, plural|
assert_equal(singular, plural.singularize)
end
end
def test_titleize
- InflectorTest::MixtureToTitleCase.each do |before, titleized|
+ MixtureToTitleCase.each do |before, titleized|
assert_equal(titleized, before.titleize)
end
end
def test_camelize
- InflectorTest::CamelToUnderscore.each do |camel, underscore|
+ CamelToUnderscore.each do |camel, underscore|
assert_equal(camel, underscore.camelize)
end
end
def test_underscore
- InflectorTest::CamelToUnderscore.each do |camel, underscore|
+ CamelToUnderscore.each do |camel, underscore|
assert_equal(underscore, camel.underscore)
end
@@ -38,7 +41,7 @@ class StringInflectionsTest < Test::Unit::TestCase
end
def test_underscore_to_lower_camel
- InflectorTest::UnderscoreToLowerCamel.each do |underscored, lower_camel|
+ UnderscoreToLowerCamel.each do |underscored, lower_camel|
assert_equal(lower_camel, underscored.camelize(:lower))
end
end
@@ -48,29 +51,29 @@ class StringInflectionsTest < Test::Unit::TestCase
end
def test_foreign_key
- InflectorTest::ClassNameToForeignKeyWithUnderscore.each do |klass, foreign_key|
+ ClassNameToForeignKeyWithUnderscore.each do |klass, foreign_key|
assert_equal(foreign_key, klass.foreign_key)
end
- InflectorTest::ClassNameToForeignKeyWithoutUnderscore.each do |klass, foreign_key|
+ ClassNameToForeignKeyWithoutUnderscore.each do |klass, foreign_key|
assert_equal(foreign_key, klass.foreign_key(false))
end
end
def test_tableize
- InflectorTest::ClassNameToTableName.each do |class_name, table_name|
+ ClassNameToTableName.each do |class_name, table_name|
assert_equal(table_name, class_name.tableize)
end
end
def test_classify
- InflectorTest::ClassNameToTableName.each do |class_name, table_name|
+ ClassNameToTableName.each do |class_name, table_name|
assert_equal(class_name, table_name.classify)
end
end
def test_humanize
- InflectorTest::UnderscoreToHuman.each do |underscore, human|
+ UnderscoreToHuman.each do |underscore, human|
assert_equal(human, underscore.humanize)
end
end