Sha256: 7bba658bf34aa423891e5426be2a04e356f47bbad2510f13ae66b35fcde9e56a
Contents?: true
Size: 1.12 KB
Versions: 1
Compression:
Stored size: 1.12 KB
Contents
require 'spec_helper' describe CF::String do describe 'from_string' do it 'should return a CF::String' do CF::String.from_string('A CF string').should be_a(CF::String) end # The intent is to force feed CF::String with an invalid utf-8 string # but jruby doesn't seem to allow this to be constructed unless RUBY_ENGINE == 'jruby' context 'with invalid data' do it 'returns nil' do CF::String.from_string("\xff\xff\xff".force_encoding('UTF-8')).should be_nil end end end end describe '#to_s' do it 'should return a utf ruby string' do ruby_string = CF::String.from_string('A CF string').to_s ruby_string.should == 'A CF string' ruby_string.encoding.should == Encoding::UTF_8 end end describe 'to_ruby' do it 'should behave like to_s' do CF::String.from_string('A CF string').to_ruby.should == 'A CF string' CF::String.from_string('A CF string').to_ruby.encoding.should == Encoding::UTF_8 end end it 'should be comparable' do CF::String.from_string('aaa').should <= CF::String.from_string('zzz') end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
corefoundation-0.1.4 | spec/string_spec.rb |