Sha256: 4c56c838e49d5b7922c6307eda4705cd14405cb2cf93689f198b86aaee4fcb16
Contents?: true
Size: 1.84 KB
Versions: 3
Compression:
Stored size: 1.84 KB
Contents
require 'spec_helper' module BicValidation describe Bic do context 'with bogus data' do it 'survives nil data' do bic = Bic.new(nil) expect(bic).to be_invalid end it 'survives integer data' do bic = Bic.new(123) expect(bic).to be_invalid end it 'survives float data' do bic = Bic.new(1.23) expect(bic).to be_invalid end end context 'basic methods 11 digit' do before { @bic = Bic.new 'MARKDEF1850' } subject { @bic } describe '#valid?' do it { should be_valid } end describe '#known?' do it { should be_known } end describe '#bank' do its(:bank) { should eq('MARK') } end describe '#country' do its(:country) { should eq('DE') } end describe '#location' do its(:location) { should eq('F1') } end describe '#branch' do its(:branch) { should eq('850') } end end context 'basic methods 8 digit' do before { @bic = Bic.new 'DEUTDEBB' } subject { @bic } describe '#valid?' do it { should be_valid } end describe '#known?' do it { should be_known } end describe '#bank' do its(:bank) { should eq('DEUT') } end describe '#country' do its(:country) { should eq('DE') } end describe '#location' do its(:location) { should eq('BB') } end describe '#branch' do its(:branch) { should be_nil } end end ['DEUTDEBB', 'CRESCHZZ10S', 'UBSWCHZH86N', 'OEKOATWWXXX', 'OEKOATWW'].each do |swift| describe 'validity checks' do it "validates #{swift}" do bic = Bic.new(swift) expect(bic).to be_valid expect(bic).to be_known end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bic_validation-0.3.0 | spec/bic_validation/bic_spec.rb |
bic_validation-0.2.1 | spec/bic_validation/bic_spec.rb |
bic_validation-0.2.0 | spec/bic_validation/bic_spec.rb |