aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2017-08-03 11:33:18 -0400
committerGitHub <noreply@github.com>2017-08-03 11:33:18 -0400
commitf105ab0445b07d11d551678f9fbc3298301da5a1 (patch)
tree21b60d25f9bc5ffc72830548bf7df3ab43e1bfd2 /activesupport/test
parent5fd50c387bdfc2761859ec7a57477bcd56e93210 (diff)
parent13fd153429e337ad8b9690fcf00c1019037c917f (diff)
downloadrails-f105ab0445b07d11d551678f9fbc3298301da5a1.tar.gz
rails-f105ab0445b07d11d551678f9fbc3298301da5a1.tar.bz2
rails-f105ab0445b07d11d551678f9fbc3298301da5a1.zip
Merge pull request #30039 from ricardotk002/fix-string-camelize-invalid-option
Update String#camelize to provide feedback when a wrong option is sent
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/core_ext/string_ext_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb
index 0afff5aa50..9fd6d8ac0f 100644
--- a/activesupport/test/core_ext/string_ext_test.rb
+++ b/activesupport/test/core_ext/string_ext_test.rb
@@ -108,6 +108,13 @@ class StringInflectionsTest < ActiveSupport::TestCase
assert_equal("capital", "Capital".camelize(:lower))
end
+ def test_camelize_invalid_option
+ e = assert_raise ArgumentError do
+ "Capital".camelize(nil)
+ end
+ assert_equal("Invalid option, use either :upper or :lower.", e.message)
+ end
+
def test_dasherize
UnderscoresToDashes.each do |underscored, dasherized|
assert_equal(dasherized, underscored.dasherize)