Permalink
Browse files

Fix Multibyte::Chars#upcase/downcase

  • Loading branch information...
1 parent 348c170 commit 94d32393aedb62b7bcedcde9f05f418d33884c1b @technoweenie committed Apr 13, 2012
Showing with 19 additions and 2 deletions.
  1. +2 −2 lib/mail/multibyte/chars.rb
  2. +17 −0 spec/mail/multibyte_spec.rb
@@ -339,15 +339,15 @@ def limit(limit)
# Example:
# 'Laurent, où sont les tests ?'.mb_chars.upcase.to_s # => "LAURENT, OÙ SONT LES TESTS ?"
def upcase
- chars(Unicode.apply_mapping(@wrapped_string), :uppercase_mapping)
+ chars(Unicode.apply_mapping(@wrapped_string, :uppercase_mapping))
end
# Convert characters in the string to lowercase.
#
# Example:
# 'VĚDA A VÝZKUM'.mb_chars.downcase.to_s # => "věda a výzkum"
def downcase
- chars(Unicode.apply_mapping(@wrapped_string), :lowercase_mapping)
+ chars(Unicode.apply_mapping(@wrapped_string, :lowercase_mapping))
end
# Converts the first character to uppercase and the remainder to lowercase.
@@ -0,0 +1,17 @@
+# encoding: utf-8
+require 'spec_helper'
+
+describe "multibyte/chars" do
+ Chars = Mail::Multibyte::Chars
+
+ it "should upcase" do
+ chars = Chars.new('Laurent, où sont les tests ?')
+ chars.upcase.should == "LAURENT, OÙ SONT LES TESTS ?"
+ end
+
+ it "should downcase" do
+ chars = Chars.new('VĚDA A VÝZKUM')
+ chars.downcase.should == "věda a výzkum"
+ end
+end
+

0 comments on commit 94d3239

Please sign in to comment.