aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/multibyte_chars_test.rb
diff options
context:
space:
mode:
authorNorman Clarke <norman@njclarke.com>2010-05-28 16:36:22 -0300
committerJosé Valim <jose.valim@gmail.com>2010-06-20 00:51:19 +0200
commit667522ca9834ce1f173a3421fb0bf0f555324c6f (patch)
treede11e65ee1b98c07066acb1848c2f9fdcb0f1f4c /activesupport/test/multibyte_chars_test.rb
parent95a8f252c028c94b70cce4888bce42b7e9e30786 (diff)
downloadrails-667522ca9834ce1f173a3421fb0bf0f555324c6f.tar.gz
rails-667522ca9834ce1f173a3421fb0bf0f555324c6f.tar.bz2
rails-667522ca9834ce1f173a3421fb0bf0f555324c6f.zip
Adds titleize/titlecase to AS::Multibyte::Chars
[#2794 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activesupport/test/multibyte_chars_test.rb')
-rw-r--r--activesupport/test/multibyte_chars_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/activesupport/test/multibyte_chars_test.rb b/activesupport/test/multibyte_chars_test.rb
index f7a5834527..602828ef5f 100644
--- a/activesupport/test/multibyte_chars_test.rb
+++ b/activesupport/test/multibyte_chars_test.rb
@@ -443,6 +443,11 @@ class MultibyteCharsUTF8BehaviourTest < Test::Unit::TestCase
assert_equal 'Abc', 'abc'.mb_chars.capitalize
end
+ def test_titleize_should_work_on_ascii_characters
+ assert_equal '', ''.mb_chars.titleize
+ assert_equal 'Abc Abc', 'abc abc'.mb_chars.titleize
+ end
+
def test_respond_to_knows_which_methods_the_proxy_responds_to
assert ''.mb_chars.respond_to?(:slice) # Defined on Chars
assert ''.mb_chars.respond_to?(:capitalize!) # Defined on Chars
@@ -480,6 +485,15 @@ class MultibyteCharsExtrasTest < Test::Unit::TestCase
end
end
+ def test_titleize_should_be_unicode_aware
+ assert_equal "Él Que Se Enteró", chars("ÉL QUE SE ENTERÓ").titleize
+ assert_equal "Абвг Абвг", chars("аБвг аБвг").titleize
+ end
+
+ def test_titleize_should_not_affect_characters_that_do_not_case_fold
+ assert_equal "日本語", chars("日本語").titleize
+ end
+
def test_limit_should_not_break_on_blank_strings
example = chars('')
assert_equal example, example.limit(0)