Sha256: 4315c7c5da75f6d3884cca79e300a84eda07ef8ac63eaba374fafe8b37a58cf7
Contents?: true
Size: 1.84 KB
Versions: 11
Compression:
Stored size: 1.84 KB
Contents
# encoding: UTF-8 require 'spec_helper' module ICU describe Lib do describe 'error checking' do let(:return_value) { double } context 'upon success' do it 'returns the block result' do Lib.check_error { |status| return_value }.should == return_value Lib.check_error { |status| status.write_int(0); return_value }.should == return_value end end context 'upon failure' do it 'raises an error' do expect { Lib.check_error { |status| status.write_int(1) } }.to raise_error ICU::Error, /U_.*_ERROR/ end end context 'upon warning' do before(:each) { @verbose = $VERBOSE } after(:each) { $VERBOSE = @verbose } context 'when warnings are enabled' do before(:each) { $VERBOSE = true } it 'prints to STDERR and returns the block result' do $stderr.should_receive(:puts) { |message| message.should match /U_.*_WARNING/ } Lib.check_error { |status| status.write_int(-127); return_value }.should == return_value end end context 'when warnings are disabled' do before(:each) { $VERBOSE = false } it 'returns the block result' do $stderr.should_not_receive(:puts) Lib.check_error { |status| status.write_int(-127); return_value }.should == return_value end end end end if Gem::Version.new('4.2') <= Gem::Version.new(Lib.version) describe 'CLDR version' do subject { Lib.cldr_version } it { should be_a Lib::VersionInfo } it('is populated') { subject.to_a.should_not == [0,0,0,0] } end end describe 'ICU version' do subject { Lib.version } it { should be_a Lib::VersionInfo } it('is populated') { subject.to_a.should_not == [0,0,0,0] } end end end
Version data entries
11 entries across 11 versions & 1 rubygems