aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext
diff options
context:
space:
mode:
authorKasper Timm Hansen <kaspth@gmail.com>2015-11-07 21:20:57 +0100
committerKasper Timm Hansen <kaspth@gmail.com>2015-11-07 21:20:57 +0100
commitccdc84c09c618cc931e67da83873ad43f4ff8ff8 (patch)
treeead47836aa2e3f0738769545ffa4ef67da997715 /activesupport/test/core_ext
parentcfd5b0007bfc0d6d25d81cd381c808d5ae6b2dd8 (diff)
parentc9143e15a1ba75137d6c9fe844d8b27dbc412835 (diff)
downloadrails-ccdc84c09c618cc931e67da83873ad43f4ff8ff8.tar.gz
rails-ccdc84c09c618cc931e67da83873ad43f4ff8ff8.tar.bz2
rails-ccdc84c09c618cc931e67da83873ad43f4ff8ff8.zip
Merge pull request #21897 from swaathi/master
Parameterize with options to preserve the case of string
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r--activesupport/test/core_ext/string_ext_test.rb38
1 files changed, 36 insertions, 2 deletions
diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb
index 9cc7bb1a77..2e69816364 100644
--- a/activesupport/test/core_ext/string_ext_test.rb
+++ b/activesupport/test/core_ext/string_ext_test.rb
@@ -143,15 +143,49 @@ class StringInflectionsTest < ActiveSupport::TestCase
end
end
+ def test_string_parameterized_normal_preserve_case
+ StringToParameterizedPreserveCase.each do |normal, slugged|
+ assert_equal(normal.parameterize(preserve_case: true), slugged)
+ end
+ end
+
def test_string_parameterized_no_separator
StringToParameterizeWithNoSeparator.each do |normal, slugged|
- assert_equal(normal.parameterize(''), slugged)
+ assert_equal(normal.parameterize(separator: ''), slugged)
+ end
+ end
+
+ def test_string_parameterized_no_separator_deprecated
+ StringToParameterizeWithNoSeparator.each do |normal, slugged|
+ assert_deprecated(/Passing the separator argument as a positional parameter is deprecated and will soon be removed. Use `separator: ''` instead./i) do
+ assert_equal(normal.parameterize(''), slugged)
+ end
+ end
+ end
+
+ def test_string_parameterized_no_separator_preserve_case
+ StringToParameterizePreserveCaseWithNoSeparator.each do |normal, slugged|
+ assert_equal(normal.parameterize(separator: '', preserve_case: true), slugged)
end
end
def test_string_parameterized_underscore
StringToParameterizeWithUnderscore.each do |normal, slugged|
- assert_equal(normal.parameterize('_'), slugged)
+ assert_equal(normal.parameterize(separator: '_'), slugged)
+ end
+ end
+
+ def test_string_parameterized_underscore_deprecated
+ StringToParameterizeWithUnderscore.each do |normal, slugged|
+ assert_deprecated(/Passing the separator argument as a positional parameter is deprecated and will soon be removed. Use `separator: '_'` instead./i) do
+ assert_equal(normal.parameterize('_'), slugged)
+ end
+ end
+ end
+
+ def test_string_parameterized_underscore_preserve_case
+ StringToParameterizePreserceCaseWithUnderscore.each do |normal, slugged|
+ assert_equal(normal.parameterize(separator: '_', preserve_case: true), slugged)
end
end