Sha256: 086fd8247e1b9a37e31eaa8d092a04e1ce480392b720475920edd6914f1a9185
Contents?: true
Size: 1.43 KB
Versions: 1
Compression:
Stored size: 1.43 KB
Contents
# -*- encoding : utf-8 -*- require File.dirname(__FILE__) + '/spec_helper' OBJS = ["bla", 'бла', ['bla', 'бла']] H = {:bla => 'bla', 'бла' => 1} describe "encoding-kawai" do if RUBY_VERSION < '1.9' %w{utf8 binary}.each do |enc| OBJS.each do |obj| it "should word for each object to code with #{enc} on obj: #{obj.inspect}" do obj.send("_#{enc}").should == obj end end it "should word for each object to code with #{enc} on obj: #{H.inspect}" do H.send("_#{enc}").should == H end end else %w{utf8 binary}.each do |enc| OBJS.each do |obj| it "should word for each object to code with #{enc} on obj: #{obj.inspect}" do obj.send("_#{enc}").should == obj end end it "should word for each object to code with #{enc} on obj: #{H.inspect}" do str = enc == 'utf8' ? "бла".force_encoding('utf-8') : "бла".force_encoding('binary') H.send("_#{enc}").should == {:bla => 'bla', str => 1} end it "should set encoding" do str = "бла" str.encoding.name.should == "UTF-8" str.send("_#{enc}") if enc == 'utf8' str.encoding.name.should == 'UTF-8' else str.encoding.name.should == 'ASCII-8BIT' end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
encoding-kawai-0.1 | spec/encoding-kawai_spec.rb |