spec/utils_spec.rb in sfc-room-0.0.1 vs spec/utils_spec.rb in sfc-room-0.1.0
- old
+ new
@@ -1,7 +1,8 @@
#coding:utf-8
require File.dirname(__FILE__) + '/spec_helper.rb'
+require 'kconv'
describe SFCRoom do
include SFCRoom::Utils
describe 'Utils' do
down = 'αβγδεζηθικλμνξοπρςστυφχψω'
up = 'ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ'
@@ -12,9 +13,17 @@
end
it 'can convert upcase greek to downcase ' do
str = SFCRoom::Utils.greek_downcase(up)
str.should eql(down)
end
+ it 'can convert not UTF-8 string' do
+ str = SFCRoom::Utils.greek_upcase(Kconv.tosjis(down))
+ str.should eql(Kconv.tosjis(up))
+ str = SFCRoom::Utils.greek_downcase(Kconv.tosjis(up))
+ str.should eql(Kconv.tosjis(down))
+ end
+
+
it 'not effect to other characters' do
str = SFCRoom::Utils.greek_downcase(other)
str.should eql(other)
str = SFCRoom::Utils.greek_upcase(other)
str.should eql(other)