Sha256: c303f2090702c0faa764b0dc7ce3b86b087048eddea09b6e9ac7378d4bba99b5

Contents?: true

Size: 1.45 KB

Versions: 44

Compression:

Stored size: 1.45 KB

Contents

require 'spec_helper'

describe Ibandit::IBANSplitter do
  subject(:split) { described_class.split(iban_code) }

  context 'with a valid IBAN' do
    let(:iban_code) { 'GB82WEST12345698765432' }
    its([:country_code]) { is_expected.to eq('GB') }
    its([:check_digits]) { is_expected.to eq('82') }
    its([:bank_code]) { is_expected.to eq('WEST') }
    its([:branch_code]) { is_expected.to eq('123456') }
    its([:account_number]) { is_expected.to eq('98765432') }
  end

  context 'with nil' do
    let(:iban_code) { nil }
    its([:country_code]) { is_expected.to eq(nil) }
    its([:check_digits]) { is_expected.to eq(nil) }
    its([:bank_code]) { is_expected.to eq(nil) }
    its([:branch_code]) { is_expected.to eq(nil) }
    its([:account_number]) { is_expected.to eq(nil) }
  end

  context 'with an empty string' do
    let(:iban_code) { '' }
    its([:country_code]) { is_expected.to eq(nil) }
    its([:check_digits]) { is_expected.to eq(nil) }
    its([:bank_code]) { is_expected.to eq(nil) }
    its([:branch_code]) { is_expected.to eq(nil) }
    its([:account_number]) { is_expected.to eq(nil) }
  end

  context 'with an invalid length IBAN' do
    let(:iban_code) { 'MC9320052222100112233M445' }
    its([:country_code]) { is_expected.to eq('MC') }
    its([:check_digits]) { is_expected.to eq(nil) }
    its([:bank_code]) { is_expected.to eq(nil) }
    its([:branch_code]) { is_expected.to eq(nil) }
    its([:account_number]) { is_expected.to eq(nil) }
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
ibandit-0.7.0 spec/ibandit/iban_splitter_spec.rb
ibandit-0.6.6 spec/ibandit/iban_splitter_spec.rb
ibandit-0.6.5 spec/ibandit/iban_splitter_spec.rb
ibandit-0.6.4 spec/ibandit/iban_splitter_spec.rb
ibandit-0.6.3 spec/ibandit/iban_splitter_spec.rb
ibandit-0.6.2 spec/ibandit/iban_splitter_spec.rb
ibandit-0.6.1 spec/ibandit/iban_splitter_spec.rb
ibandit-0.6.0 spec/ibandit/iban_splitter_spec.rb
ibandit-0.5.0 spec/ibandit/iban_splitter_spec.rb
ibandit-0.4.5 spec/ibandit/iban_splitter_spec.rb
ibandit-0.4.4 spec/ibandit/iban_splitter_spec.rb
ibandit-0.4.3 spec/ibandit/iban_splitter_spec.rb
ibandit-0.4.2 spec/ibandit/iban_splitter_spec.rb
ibandit-0.4.1 spec/ibandit/iban_splitter_spec.rb
ibandit-0.4.0 spec/ibandit/iban_splitter_spec.rb
ibandit-0.3.8 spec/ibandit/iban_splitter_spec.rb
ibandit-0.3.7 spec/ibandit/iban_splitter_spec.rb
ibandit-0.3.6 spec/ibandit/iban_splitter_spec.rb
ibandit-0.3.5 spec/ibandit/iban_splitter_spec.rb
ibandit-0.3.4 spec/ibandit/iban_splitter_spec.rb