Sha256: 96723b0982cb6b88c272790d93613ad383c563f4734d91fe38577b38164ea342

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 KB

Contents

require 'spec_helper'

module BankingData
  describe DutchBank do
    describe 'end-to-end test' do
      ['ABNANL2A', 'INGBNL2A', 'RABONL2U'].each do |bic|
        it "includes #{bic}" do
          expect(DutchBank.only(:bic).map(&:first)).to include(bic)
          expect(Bank.where(locale: :nl).only(:bic).map(&:first))
            .to include(bic)
        end
      end
    end

    it 'all but one bics are blank or look like bics' do
      exceptions = ['BOFSNL21002']
      bics = DutchBank.only(:bic).map(&:first) - exceptions
      # regular expression: the bic should have 8 characters, that are either
      # all white space or consist of capital letters and digits
      expect(bics.select{ |bic| !( bic =~  /\A(\s|([A-Z]|\d)){8}\z/ ) }).
        to eq([])
    end

    it 'all bank identifiers consist of 4 capital letters' do
      bank_ids = DutchBank.only(:bank_id).map(&:first)
      # regular expression: the bic should have 8 characters, that are either
      # all white space or consist of capital letters and digits
      expect(bank_ids.select{ |bank_id| !( bank_id =~  /\A[A-Z]{4}\z/ ) }).
        to eq([])
    end

    it 'all bank names have at least one letter' do
      names = DutchBank.only(:name).map(&:first)
      # regular expression: the bic should have 8 characters, that are either
      # all white space or consist of capital letters and digits
      expect(names.select{ |name| !( name =~  /\A.*[a-zA-Z]+.*\z/ ) }).
        to eq([])
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
banking_data-0.9.5 spec/banking_data/dutch_bank_spec.rb