Sha256: c867d07cac899bef7a5270640209bb6da53aa19f3c19f8a6250fb816451e5ae2
Contents?: true
Size: 1.38 KB
Versions: 2
Compression:
Stored size: 1.38 KB
Contents
# encoding: utf-8 require 'spec_helper' describe SEPA::Converter do include SEPA::Converter::InstanceMethods describe :convert_text do it 'should remove invalid chars' do expect(convert_text('&@"=<>!')).to eq('') end it 'should not touch valid chars' do expect(convert_text("abc-ABC-0123- ':?,-(+.)/")).to eq("abc-ABC-0123- ':?,-(+.)/") end it 'should convert umlaute' do expect(convert_text('üöäÜÖÄß')).to eq('uoaUOAss') end it 'should convert line breaks' do expect(convert_text("one\ntwo")) .to eq('one two') expect(convert_text("one\ntwo\n")) .to eq('one two') expect(convert_text("\none\ntwo\n")).to eq('one two') expect(convert_text("one\n\ntwo")) .to eq('one two') end it 'should convert number' do expect(convert_text(1234)).to eq('1234') end it 'should not touch nil' do expect(convert_text(nil)).to eq(nil) end end describe :convert_decimal do it "should convert Integer to BigDecimal" do expect(convert_decimal(42)).to eq(BigDecimal('42.00')) end it "should convert Float to BigDecimal" do expect(convert_decimal(42.12)).to eq(BigDecimal('42.12')) end it 'should round' do expect(convert_decimal(1.345)).to eq(BigDecimal('1.35')) end it 'should not touch nil' do expect(convert_decimal(nil)).to eq(nil) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sepa_king-0.5.0 | spec/converter_spec.rb |
sepa_king-0.4.0 | spec/converter_spec.rb |