aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2008-11-27 18:59:33 +0100
committerDavid Heinemeier Hansson <david@loudthinking.com>2008-11-27 18:59:33 +0100
commit6fa9957e0e83f327aaffe34679a5752fc2343fae (patch)
tree83b606852608845853fc5a005949812dfa5160d6 /activesupport/test
parentf2ee056873b84f8917e72d87181e1a9f5f653342 (diff)
parent4d910b033379727e5e7355590c50c72fc75e56db (diff)
downloadrails-6fa9957e0e83f327aaffe34679a5752fc2343fae.tar.gz
rails-6fa9957e0e83f327aaffe34679a5752fc2343fae.tar.bz2
rails-6fa9957e0e83f327aaffe34679a5752fc2343fae.zip
Merge branch 'master' of git@github.com:rails/rails
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/inflector_test.rb6
-rw-r--r--activesupport/test/inflector_test_cases.rb15
2 files changed, 19 insertions, 2 deletions
diff --git a/activesupport/test/inflector_test.rb b/activesupport/test/inflector_test.rb
index d30852c013..d8c93dc9ae 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_and_normalize
+ StringToParameterizedAndNormalized.each do |some_string, parameterized_string|
+ assert_equal(parameterized_string, ActiveSupport::Inflector.parameterize(some_string))
+ 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, '_'))
diff --git a/activesupport/test/inflector_test_cases.rb b/activesupport/test/inflector_test_cases.rb
index 3aa18ca781..481c3e835c 100644
--- a/activesupport/test/inflector_test_cases.rb
+++ b/activesupport/test/inflector_test_cases.rb
@@ -147,14 +147,25 @@ module InflectorTestCases
StringToParameterized = {
"Donald E. Knuth" => "donald-e-knuth",
"Random text with *(bad)* characters" => "random-text-with-bad-characters",
- "Malmö" => "malmo",
- "Garçons" => "garcons",
"Allow_Under_Scores" => "allow_under_scores",
"Trailing bad characters!@#" => "trailing-bad-characters",
"!@#Leading bad characters" => "leading-bad-characters",
"Squeeze separators" => "squeeze-separators"
}
+ # Ruby 1.9 doesn't do Unicode normalization yet.
+ if RUBY_VERSION >= '1.9'
+ StringToParameterizedAndNormalized = {
+ "Malmö" => "malm",
+ "Garçons" => "gar-ons"
+ }
+ else
+ StringToParameterizedAndNormalized = {
+ "Malmö" => "malmo",
+ "Garçons" => "garcons"
+ }
+ end
+
UnderscoreToHuman = {
"employee_salary" => "Employee salary",
"employee_id" => "Employee",