aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/inflector_test.rb
diff options
context:
space:
mode:
authorAdam Cigánek <adam.ciganek@gmail.com>2008-09-12 14:45:11 +0200
committerMichael Koziarski <michael@koziarski.com>2008-09-23 08:08:21 +0200
commita4f2ba8fb3c46ef9f7e31725849efdcb1a22c72d (patch)
tree7213d54c6b58397392c697e3f9e15d53a889ee77 /activesupport/test/inflector_test.rb
parent961e2b861096c67573f3ddd2c9e55bb0658d6d88 (diff)
downloadrails-a4f2ba8fb3c46ef9f7e31725849efdcb1a22c72d.tar.gz
rails-a4f2ba8fb3c46ef9f7e31725849efdcb1a22c72d.tar.bz2
rails-a4f2ba8fb3c46ef9f7e31725849efdcb1a22c72d.zip
Modified ActiveSupport::Inflector#parameterize with code from slugalizer (http://github.com/henrik/slugalizer)
Handles trailing and leading slashes, and squashes repeated separators into a single character. Signed-off-by: Michael Koziarski <michael@koziarski.com> [#1034 state:committed]
Diffstat (limited to 'activesupport/test/inflector_test.rb')
-rw-r--r--activesupport/test/inflector_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activesupport/test/inflector_test.rb b/activesupport/test/inflector_test.rb
index f304844e82..d30852c013 100644
--- a/activesupport/test/inflector_test.rb
+++ b/activesupport/test/inflector_test.rb
@@ -104,6 +104,12 @@ class InflectorTest < Test::Unit::TestCase
end
end
+ def test_parameterize_with_custom_separator
+ StringToParameterized.each do |some_string, parameterized_string|
+ assert_equal(parameterized_string.gsub('-', '_'), ActiveSupport::Inflector.parameterize(some_string, '_'))
+ end
+ end
+
def test_classify
ClassNameToTableName.each do |class_name, table_name|
assert_equal(class_name, ActiveSupport::Inflector.classify(table_name))