diff options
author | Eileen M. Uchitelle <eileencodes@users.noreply.github.com> | 2019-07-17 09:55:12 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-17 09:55:12 -0400 |
commit | e4747a4965ad7f081f6c66cadcadffe0545e4025 (patch) | |
tree | 909515a96d7f1a6982b99d6ded86505a06ae98b0 /activesupport/test | |
parent | 2a28b7c292b3d6c0a01722f50beedb8ec1bf074c (diff) | |
parent | 05f9e3ef92114c2df978009073d0b47fe1323eb7 (diff) | |
download | rails-e4747a4965ad7f081f6c66cadcadffe0545e4025.tar.gz rails-e4747a4965ad7f081f6c66cadcadffe0545e4025.tar.bz2 rails-e4747a4965ad7f081f6c66cadcadffe0545e4025.zip |
Merge pull request #36690 from cpruitt/make-parameterize-requires-utf-8-explicit
Make UTF-8 string requirement explicit for `ActiveSupport::Inflector.transliterate`
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/transliterate_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activesupport/test/transliterate_test.rb b/activesupport/test/transliterate_test.rb index 9e29a93ea0..525b4a8559 100644 --- a/activesupport/test/transliterate_test.rb +++ b/activesupport/test/transliterate_test.rb @@ -57,4 +57,12 @@ class TransliterateTest < ActiveSupport::TestCase end assert_equal "Can only transliterate strings. Received Object", exception.message end + + def test_transliterate_handles_non_unicode_strings + ascii_8bit_string = "A".b + exception = assert_raises ArgumentError do + assert_equal "A", ActiveSupport::Inflector.transliterate(ascii_8bit_string) + end + assert_equal "Can only transliterate UTF-8 strings. Received string with encoding ASCII-8BIT", exception.message + end end |