Skip to content

Commit

Permalink
Fix Multibyte::Chars#upcase/downcase
Browse files Browse the repository at this point in the history
  • Loading branch information
technoweenie committed Apr 13, 2012
1 parent 348c170 commit 94d3239
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/mail/multibyte/chars.rb
Expand Up @@ -339,15 +339,15 @@ def limit(limit)
# Example: # Example:
# 'Laurent, où sont les tests ?'.mb_chars.upcase.to_s # => "LAURENT, OÙ SONT LES TESTS ?" # 'Laurent, où sont les tests ?'.mb_chars.upcase.to_s # => "LAURENT, OÙ SONT LES TESTS ?"
def upcase def upcase
chars(Unicode.apply_mapping(@wrapped_string), :uppercase_mapping) chars(Unicode.apply_mapping(@wrapped_string, :uppercase_mapping))
end end


# Convert characters in the string to lowercase. # Convert characters in the string to lowercase.
# #
# Example: # Example:
# 'VĚDA A VÝZKUM'.mb_chars.downcase.to_s # => "věda a výzkum" # 'VĚDA A VÝZKUM'.mb_chars.downcase.to_s # => "věda a výzkum"
def downcase def downcase
chars(Unicode.apply_mapping(@wrapped_string), :lowercase_mapping) chars(Unicode.apply_mapping(@wrapped_string, :lowercase_mapping))
end end


# Converts the first character to uppercase and the remainder to lowercase. # Converts the first character to uppercase and the remainder to lowercase.
Expand Down
17 changes: 17 additions & 0 deletions spec/mail/multibyte_spec.rb
@@ -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.