Sha256: fc8157b1ff103359e2792547f3232c88ceb5ed2c4532f47a7316a7e268533881

Contents?: true

Size: 1.34 KB

Versions: 7

Compression:

Stored size: 1.34 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe SPS::CreditorAccount do
  it 'should initialize a new account' do
    expect(
      SPS::CreditorAccount.new(
        name:                'Gläubiger GmbH',
        bic:                 'BANKDEFFXXX',
        iban:                'DE87200500001234567890',
        creditor_identifier: 'DE98ZZZ09999999999'
      )
    ).to be_valid
  end

  describe :creditor_identifier do
    it 'should accept valid value' do
      expect(SPS::CreditorAccount)
        .to accept(
          'DE98ZZZ09999999999',
          'AT12ZZZ00000000001',
          'IT97ZZZA1B2C3D4E5F6G7H8',
          'NL97ZZZ123456780001',
          'FR12ZZZ123456',
          for: :creditor_identifier
        )
    end

    it 'should not accept invalid value' do
      expect(SPS::CreditorAccount)
        .not_to accept(
          '',
          'invalid',
          'DE98ZZZ099999999990',
          'DEAAAAAAAAAAAAAAAA',
          for: :creditor_identifier
        )
    end
  end

  describe :isr_participant_number do
    it 'should accept valid value' do
      expect(SPS::CreditorAccount)
        .to accept('123123123', '554544543', nil, for: :isr_participant_number)
    end

    it 'should not accept invalid value' do
      expect(SPS::CreditorAccount)
        .not_to accept('32423432', 'a89898989', for: :isr_participant_number)
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sps_king-0.5.0 spec/lib/sps_king/account/creditor_account_spec.rb
sps_king-0.4.0 spec/lib/sps_king/account/creditor_account_spec.rb
sps_king-0.3.1 spec/lib/sps_king/account/creditor_account_spec.rb
sps_king-0.3.0 spec/lib/sps_king/account/creditor_account_spec.rb
sps_king-0.2.0 spec/lib/sps_king/account/creditor_account_spec.rb
sps_king-0.1.1 spec/lib/sps_king/account/creditor_account_spec.rb
sps_king-0.1.0 spec/lib/sps_king/account/creditor_account_spec.rb