Sha256: 06745eb31325b75986917c907b9f1ff6fa6864f27aad454380e23f3de93e723e

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 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
      convert_text('&@"=<>!').should == ''
    end

    it 'should not touch valid chars' do
      convert_text("abc-ABC-0123- ':?,-(+.)/").should == "abc-ABC-0123- ':?,-(+.)/"
    end

    it 'should convert umlaute' do
      convert_text('üöäÜÖÄß').should == 'ueoeaeUEOEAEss'
    end

    it 'should convert number' do
      convert_text(1234).should == '1234'
    end

    it 'should not touch nil' do
      convert_text(nil).should == nil
    end
  end

  describe :convert_decimal do
    it "should convert Integer to BigDecimal" do
      convert_decimal(42).should == BigDecimal('42.00')
    end

    it "should convert Float to BigDecimal" do
      convert_decimal(42.12).should == BigDecimal('42.12')
    end

    it 'should round' do
      convert_decimal(1.345).should == BigDecimal('1.35')
    end

    it 'should not touch nil' do
      convert_decimal(nil).should == nil
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sepa_king-0.0.7 spec/converter_spec.rb
sepa_king-0.0.6 spec/converter_spec.rb
sepa_king-0.0.5 spec/converter_spec.rb
sepa_king-0.0.4 spec/converter_spec.rb