ibandit 0.11.27 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +37 -0
  3. data/.rubocop.yml +7 -10
  4. data/.rubocop_todo.yml +70 -15
  5. data/CHANGELOG.md +24 -0
  6. data/Gemfile +0 -6
  7. data/README.md +7 -7
  8. data/data/german_iban_rules.yml +1099 -1594
  9. data/data/raw/BLZ2.txt +15947 -17888
  10. data/data/structures.yml +4 -4
  11. data/ibandit.gemspec +4 -3
  12. data/lib/ibandit.rb +7 -4
  13. data/lib/ibandit/check_digit.rb +3 -1
  14. data/lib/ibandit/constants.rb +3 -1
  15. data/lib/ibandit/errors.rb +2 -0
  16. data/lib/ibandit/german_details_converter.rb +26 -2
  17. data/lib/ibandit/iban.rb +18 -11
  18. data/lib/ibandit/iban_assembler.rb +2 -0
  19. data/lib/ibandit/iban_splitter.rb +8 -7
  20. data/lib/ibandit/local_details_cleaner.rb +40 -37
  21. data/lib/ibandit/pseudo_iban_assembler.rb +5 -1
  22. data/lib/ibandit/pseudo_iban_splitter.rb +7 -1
  23. data/lib/ibandit/sweden/bank_lookup.rb +2 -0
  24. data/lib/ibandit/sweden/local_details_converter.rb +6 -2
  25. data/lib/ibandit/sweden/validator.rb +2 -0
  26. data/lib/ibandit/version.rb +3 -1
  27. data/spec/fixtures/germany_integration_test_cases.json +21 -21
  28. data/spec/fixtures/germany_unit_test_cases.json +20 -6
  29. data/spec/ibandit/constants_spec.rb +2 -0
  30. data/spec/ibandit/german_details_converter_spec.rb +9 -3
  31. data/spec/ibandit/iban_assembler_spec.rb +92 -3
  32. data/spec/ibandit/iban_spec.rb +209 -17
  33. data/spec/ibandit/iban_splitter_spec.rb +6 -0
  34. data/spec/ibandit/local_details_cleaner_spec.rb +136 -6
  35. data/spec/ibandit/pseudo_iban_assembler_spec.rb +3 -1
  36. data/spec/ibandit/pseudo_iban_splitter_spec.rb +2 -0
  37. data/spec/ibandit/structure_spec.rb +6 -4
  38. data/spec/ibandit/sweden/local_details_converter_spec.rb +3 -0
  39. data/spec/ibandit/sweden/validator_spec.rb +35 -0
  40. data/spec/spec_helper.rb +2 -0
  41. metadata +21 -8
  42. data/.travis.yml +0 -16
@@ -1,7 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "spec_helper"
2
4
 
3
5
  describe Ibandit::IBAN do
4
6
  subject(:iban) { described_class.new(arg) }
7
+
5
8
  let(:arg) { iban_code }
6
9
  let(:iban_code) { "GB82WEST12345698765432" }
7
10
 
@@ -9,16 +12,19 @@ describe Ibandit::IBAN do
9
12
 
10
13
  context "with a poorly formatted IBAN" do
11
14
  let(:iban_code) { " gb82 WeSt 1234 5698 7654 32\n" }
15
+
12
16
  its(:iban) { is_expected.to eq("GB82WEST12345698765432") }
13
17
  end
14
18
 
15
19
  context "with nil" do
16
20
  let(:arg) { nil }
21
+
17
22
  specify { expect { iban }.to raise_error(TypeError) }
18
23
  end
19
24
 
20
25
  context "with an invalid pseudo IBAN" do
21
26
  let(:arg) { "dezzzz" }
27
+
22
28
  its(:iban) { is_expected.to eq("DEZZZZ") }
23
29
  end
24
30
 
@@ -93,6 +99,7 @@ describe Ibandit::IBAN do
93
99
 
94
100
  context "when the IBAN was created from a Slovenian IBAN" do
95
101
  let(:iban_code) { "SI56 1910 0000 0123 438" }
102
+
96
103
  its(:country_code) { is_expected.to eq("SI") }
97
104
  its(:bank_code) { is_expected.to eq("19100") }
98
105
  its(:branch_code) { is_expected.to be_nil }
@@ -331,6 +338,7 @@ describe Ibandit::IBAN do
331
338
 
332
339
  its(:iban) { is_expected.to be_nil }
333
340
  its(:pseudo_iban) { is_expected.to eq(arg) }
341
+
334
342
  it "is invalid and has the correct errors" do
335
343
  expect(subject.valid?).to eq(false)
336
344
  expect(subject.errors).
@@ -349,6 +357,7 @@ describe Ibandit::IBAN do
349
357
 
350
358
  its(:iban) { is_expected.to be_nil }
351
359
  its(:pseudo_iban) { is_expected.to eq("AUZZ123456______1234") }
360
+
352
361
  it "is invalid and has the correct errors" do
353
362
  expect(subject.valid?).to eq(false)
354
363
  expect(subject.errors).to eq(
@@ -368,6 +377,7 @@ describe Ibandit::IBAN do
368
377
 
369
378
  its(:iban) { is_expected.to be_nil }
370
379
  its(:pseudo_iban) { is_expected.to eq("AUZZ1234XX123456789:") }
380
+
371
381
  it "is invalid and has the correct errors" do
372
382
  expect(subject.valid?).to eq(false)
373
383
  expect(subject.errors).to eq(account_number: "is invalid",
@@ -498,6 +508,7 @@ describe Ibandit::IBAN do
498
508
  account_number: account_number,
499
509
  }
500
510
  end
511
+
501
512
  context "with a 3 digit account number suffix" do
502
513
  let(:account_number) { "3333333-944" }
503
514
 
@@ -515,6 +526,7 @@ describe Ibandit::IBAN do
515
526
  its(:valid?) { is_expected.to eq(true) }
516
527
  its(:to_s) { is_expected.to eq("") }
517
528
  end
529
+
518
530
  context "with a 2 digit account number suffix" do
519
531
  let(:account_number) { "3333333-44" }
520
532
 
@@ -532,6 +544,7 @@ describe Ibandit::IBAN do
532
544
  its(:valid?) { is_expected.to eq(true) }
533
545
  its(:to_s) { is_expected.to eq("") }
534
546
  end
547
+
535
548
  context "with bank and branch code embedded in account_number field" do
536
549
  let(:arg) do
537
550
  {
@@ -554,6 +567,7 @@ describe Ibandit::IBAN do
554
567
  its(:valid?) { is_expected.to eq(true) }
555
568
  its(:to_s) { is_expected.to eq("") }
556
569
  end
570
+
557
571
  context "with a bank code embedded in account_number field" do
558
572
  let(:arg) do
559
573
  {
@@ -595,6 +609,7 @@ describe Ibandit::IBAN do
595
609
 
596
610
  its(:iban) { is_expected.to be_nil }
597
611
  its(:pseudo_iban) { is_expected.to eq(arg) }
612
+
598
613
  it "is invalid and has the correct errors" do
599
614
  expect(subject.valid?).to eq(false)
600
615
  expect(subject.errors).
@@ -612,7 +627,7 @@ describe Ibandit::IBAN do
612
627
  end
613
628
 
614
629
  context "and a 9 digit bank code" do
615
- let(:bank_code) { "965498456" }
630
+ let(:bank_code) { "026073150" }
616
631
  let(:account_number) { "01234567890123456" }
617
632
 
618
633
  its(:country_code) { is_expected.to eq("US") }
@@ -622,8 +637,9 @@ describe Ibandit::IBAN do
622
637
  its(:swift_branch_code) { is_expected.to eq(nil) }
623
638
  its(:swift_account_number) { is_expected.to eq(account_number) }
624
639
  its(:swift_national_id) { is_expected.to eq(bank_code) }
640
+
625
641
  its(:pseudo_iban) do
626
- is_expected.to eq("USZZ96549845601234567890123456")
642
+ is_expected.to eq("USZZ02607315001234567890123456")
627
643
  end
628
644
 
629
645
  its(:iban) { is_expected.to be_nil }
@@ -642,6 +658,7 @@ describe Ibandit::IBAN do
642
658
  its(:swift_branch_code) { is_expected.to eq(nil) }
643
659
  its(:swift_account_number) { is_expected.to eq(account_number) }
644
660
  its(:swift_national_id) { is_expected.to eq(bank_code) }
661
+
645
662
  its(:pseudo_iban) do
646
663
  is_expected.to eq("USZZ__012345601234567890123456")
647
664
  end
@@ -665,7 +682,7 @@ describe Ibandit::IBAN do
665
682
 
666
683
  context "and a 7 digit account number" do
667
684
  let(:account_number) { "0123456" }
668
- let(:bank_code) { "965498456" }
685
+ let(:bank_code) { "026073150" }
669
686
 
670
687
  its(:country_code) { is_expected.to eq("US") }
671
688
  its(:bank_code) { is_expected.to eq(bank_code) }
@@ -674,8 +691,9 @@ describe Ibandit::IBAN do
674
691
  its(:swift_branch_code) { is_expected.to eq(nil) }
675
692
  its(:swift_account_number) { is_expected.to eq("__________0123456") }
676
693
  its(:swift_national_id) { is_expected.to eq(bank_code) }
694
+
677
695
  its(:pseudo_iban) do
678
- is_expected.to eq("USZZ965498456__________0123456")
696
+ is_expected.to eq("USZZ026073150__________0123456")
679
697
  end
680
698
 
681
699
  its(:iban) { is_expected.to be_nil }
@@ -683,9 +701,21 @@ describe Ibandit::IBAN do
683
701
  its(:to_s) { is_expected.to eq("") }
684
702
  end
685
703
 
704
+ context "and bank code that is nil" do
705
+ let(:bank_code) { nil }
706
+ let(:account_number) { "01234567890123456" }
707
+
708
+ its(:iban) { is_expected.to be_nil }
709
+
710
+ it "returns an error on bank_code attribute" do
711
+ expect(subject.valid?).to eq(false)
712
+ expect(subject.errors).to eq(bank_code: "is required")
713
+ end
714
+ end
715
+
686
716
  context "and a 17 digit account number" do
687
717
  let(:account_number) { "01234567890123456" }
688
- let(:bank_code) { "965498456" }
718
+ let(:bank_code) { "026073150" }
689
719
 
690
720
  its(:country_code) { is_expected.to eq("US") }
691
721
  its(:bank_code) { is_expected.to eq(bank_code) }
@@ -694,8 +724,9 @@ describe Ibandit::IBAN do
694
724
  its(:swift_branch_code) { is_expected.to eq(nil) }
695
725
  its(:swift_account_number) { is_expected.to eq(account_number) }
696
726
  its(:swift_national_id) { is_expected.to eq(bank_code) }
727
+
697
728
  its(:pseudo_iban) do
698
- is_expected.to eq("USZZ96549845601234567890123456")
729
+ is_expected.to eq("USZZ02607315001234567890123456")
699
730
  end
700
731
 
701
732
  its(:iban) { is_expected.to be_nil }
@@ -705,18 +736,19 @@ describe Ibandit::IBAN do
705
736
  end
706
737
 
707
738
  context "when the IBAN was created from a US pseudo-IBAN" do
708
- let(:arg) { "USZZ96549845601234567890123456" }
739
+ let(:arg) { "USZZ02607315001234567890123456" }
709
740
 
710
741
  its(:country_code) { is_expected.to eq("US") }
711
- its(:bank_code) { is_expected.to eq("965498456") }
742
+ its(:bank_code) { is_expected.to eq("026073150") }
712
743
  its(:branch_code) { is_expected.to be_nil }
713
744
  its(:account_number) { is_expected.to eq("01234567890123456") }
714
- its(:swift_bank_code) { is_expected.to eq("965498456") }
745
+ its(:swift_bank_code) { is_expected.to eq("026073150") }
715
746
  its(:swift_branch_code) { is_expected.to eq(nil) }
716
747
  its(:swift_account_number) { is_expected.to eq("01234567890123456") }
717
- its(:swift_national_id) { is_expected.to eq("965498456") }
748
+ its(:swift_national_id) { is_expected.to eq("026073150") }
749
+
718
750
  its(:pseudo_iban) do
719
- is_expected.to eq("USZZ96549845601234567890123456")
751
+ is_expected.to eq("USZZ02607315001234567890123456")
720
752
  end
721
753
 
722
754
  its(:iban) { is_expected.to be_nil }
@@ -735,7 +767,7 @@ describe Ibandit::IBAN do
735
767
  end
736
768
 
737
769
  context "when the input pseudo-IBAN has an invalid US account_number" do
738
- let(:arg) { "USZZ965498456ABC01234567890123" }
770
+ let(:arg) { "USZZ026073150ABC01234567890123" }
739
771
 
740
772
  it "is invalid and has an error populated" do
741
773
  expect(subject.valid?).to eq(false)
@@ -756,6 +788,7 @@ describe Ibandit::IBAN do
756
788
 
757
789
  context "with the IBAN is nil" do
758
790
  let(:arg) { { country_code: "GB" } }
791
+
759
792
  its(:to_s) { is_expected.to_not be_nil }
760
793
  specify { expect(iban.to_s(:formatted)).to be_empty }
761
794
  end
@@ -768,11 +801,13 @@ describe Ibandit::IBAN do
768
801
  account_number: "0105723",
769
802
  }
770
803
  end
804
+
771
805
  specify { expect(iban.to_s).to eq("SE5412000000012810105723") }
772
806
  end
773
807
 
774
808
  context "with a Swedish pseudo-IBAN" do
775
809
  let(:arg) { "SEZZX1281XXX0105723" }
810
+
776
811
  specify { expect(iban.to_s).to eq("SE5412000000012810105723") }
777
812
  end
778
813
  end
@@ -790,7 +825,9 @@ describe Ibandit::IBAN do
790
825
 
791
826
  context "with an unknown country code" do
792
827
  before { iban.valid_country_code? }
828
+
793
829
  let(:iban_code) { "AA123456789123456" }
830
+
794
831
  it { is_expected.to eq(false) }
795
832
 
796
833
  context "locale en", locale: :en do
@@ -837,16 +874,19 @@ describe Ibandit::IBAN do
837
874
 
838
875
  context "with valid details" do
839
876
  let(:iban_code) { "GB82WEST12345698765432" }
877
+
840
878
  it { is_expected.to eq(true) }
841
879
 
842
880
  context "where the check digit is zero-padded" do
843
881
  let(:iban_code) { "GB06WEST12345698765442" }
882
+
844
883
  it { is_expected.to eq(true) }
845
884
  end
846
885
  end
847
886
 
848
887
  context "with invalid details" do
849
888
  let(:iban_code) { "GB12WEST12345698765432" }
889
+
850
890
  it { is_expected.to eq(false) }
851
891
 
852
892
  context "locale en", locale: :en do
@@ -960,6 +1000,7 @@ describe Ibandit::IBAN do
960
1000
 
961
1001
  context "with invalid characters" do
962
1002
  let(:iban_code) { "AA82-EST123456987654" }
1003
+
963
1004
  it { is_expected.to be_nil }
964
1005
 
965
1006
  it "does not set errors on the IBAN" do
@@ -970,6 +1011,7 @@ describe Ibandit::IBAN do
970
1011
 
971
1012
  context "with an empty IBAN" do
972
1013
  let(:iban_code) { "" }
1014
+
973
1015
  it { is_expected.to be_nil }
974
1016
 
975
1017
  it "does not set errors on the IBAN" do
@@ -988,6 +1030,7 @@ describe Ibandit::IBAN do
988
1030
 
989
1031
  context "with invalid details" do
990
1032
  let(:iban_code) { "GB82WEST123456987654" }
1033
+
991
1034
  it { is_expected.to eq(false) }
992
1035
 
993
1036
  context "locale en", locale: :en do
@@ -1100,6 +1143,7 @@ describe Ibandit::IBAN do
1100
1143
 
1101
1144
  context "with an invalid country_code" do
1102
1145
  let(:iban_code) { "AA82WEST123456987654" }
1146
+
1103
1147
  it { is_expected.to be_nil }
1104
1148
 
1105
1149
  it "does not set errors on the IBAN" do
@@ -1118,6 +1162,7 @@ describe Ibandit::IBAN do
1118
1162
 
1119
1163
  context "with invalid details" do
1120
1164
  before { allow(iban).to receive(:swift_bank_code).and_return("WES") }
1165
+
1121
1166
  it { is_expected.to eq(false) }
1122
1167
 
1123
1168
  context "locale en", locale: :en do
@@ -1218,6 +1263,7 @@ describe Ibandit::IBAN do
1218
1263
 
1219
1264
  context "with an invalid country_code" do
1220
1265
  before { allow(iban).to receive(:country_code).and_return("AA") }
1266
+
1221
1267
  it { is_expected.to be_nil }
1222
1268
 
1223
1269
  it "does not set errors on the IBAN" do
@@ -1236,6 +1282,7 @@ describe Ibandit::IBAN do
1236
1282
 
1237
1283
  context "with invalid details" do
1238
1284
  before { allow(iban).to receive(:swift_branch_code).and_return("12345") }
1285
+
1239
1286
  it { is_expected.to eq(false) }
1240
1287
 
1241
1288
  context "locale en", locale: :en do
@@ -1336,6 +1383,7 @@ describe Ibandit::IBAN do
1336
1383
 
1337
1384
  context "without a branch code" do
1338
1385
  before { allow(iban).to receive(:swift_branch_code).and_return(nil) }
1386
+
1339
1387
  it { is_expected.to eq(false) }
1340
1388
 
1341
1389
  context "locale en", locale: :en do
@@ -1418,6 +1466,7 @@ describe Ibandit::IBAN do
1418
1466
 
1419
1467
  context "with an invalid country_code" do
1420
1468
  before { allow(iban).to receive(:country_code).and_return("AA") }
1469
+
1421
1470
  it { is_expected.to be_nil }
1422
1471
 
1423
1472
  it "does not set errors on the IBAN" do
@@ -1438,6 +1487,7 @@ describe Ibandit::IBAN do
1438
1487
  before do
1439
1488
  allow(iban).to receive(:swift_account_number).and_return("1234567")
1440
1489
  end
1490
+
1441
1491
  it { is_expected.to eq(false) }
1442
1492
 
1443
1493
  context "locale en", locale: :en do
@@ -1540,6 +1590,7 @@ describe Ibandit::IBAN do
1540
1590
 
1541
1591
  context "with an invalid country_code" do
1542
1592
  before { allow(iban).to receive(:country_code).and_return("AA") }
1593
+
1543
1594
  it { is_expected.to be_nil }
1544
1595
 
1545
1596
  it "does not set errors on the IBAN" do
@@ -1554,11 +1605,13 @@ describe Ibandit::IBAN do
1554
1605
 
1555
1606
  context "with valid details" do
1556
1607
  let(:iban_code) { "GB82WEST12345698765432" }
1608
+
1557
1609
  it { is_expected.to eq(true) }
1558
1610
  end
1559
1611
 
1560
1612
  context "with invalid details" do
1561
1613
  let(:iban_code) { "GB-123ABCD" }
1614
+
1562
1615
  it { is_expected.to eq(false) }
1563
1616
 
1564
1617
  context "locale en", locale: :en do
@@ -1658,11 +1711,13 @@ describe Ibandit::IBAN do
1658
1711
 
1659
1712
  context "with valid details" do
1660
1713
  let(:iban_code) { "GB82WEST12345698765432" }
1714
+
1661
1715
  it { is_expected.to eq(true) }
1662
1716
  end
1663
1717
 
1664
1718
  context "with invalid details" do
1665
1719
  let(:iban_code) { "GB82WEST12AAAAAA7654" }
1720
+
1666
1721
  it { is_expected.to eq(false) }
1667
1722
 
1668
1723
  context "locale en", locale: :en do
@@ -1756,6 +1811,7 @@ describe Ibandit::IBAN do
1756
1811
 
1757
1812
  context "with an invalid country_code" do
1758
1813
  let(:iban_code) { "AA82WEST12AAAAAA7654" }
1814
+
1759
1815
  it { is_expected.to be_nil }
1760
1816
 
1761
1817
  it "does not set errors on the IBAN" do
@@ -2117,7 +2173,9 @@ describe Ibandit::IBAN do
2117
2173
  valid_account_number?: valid_account_number,
2118
2174
  )
2119
2175
  end
2176
+
2120
2177
  after { Ibandit.modulus_checker = nil }
2178
+
2121
2179
  before { iban.valid_local_modulus_check? }
2122
2180
 
2123
2181
  context "with an invalid bank code" do
@@ -2129,7 +2187,7 @@ describe Ibandit::IBAN do
2129
2187
  it "calls valid_bank_code? with an IBAN object" do
2130
2188
  expect(Ibandit.modulus_checker).
2131
2189
  to receive(:valid_bank_code?).
2132
- with(instance_of(Ibandit::IBAN))
2190
+ with(instance_of(described_class))
2133
2191
 
2134
2192
  iban.valid_local_modulus_check?
2135
2193
  end
@@ -2190,8 +2248,11 @@ describe Ibandit::IBAN do
2190
2248
  context "with an invalid branch code" do
2191
2249
  let(:iban_code) { "GB60BARC20000055779911" }
2192
2250
  before { Ibandit.bic_finder = double(call: "BARCGB22XXX") }
2251
+
2193
2252
  after { Ibandit.bic_finder = nil }
2253
+
2194
2254
  before { iban.valid_local_modulus_check? }
2255
+
2195
2256
  let(:valid_bank_code) { true }
2196
2257
  let(:valid_branch_code) { false }
2197
2258
  let(:valid_account_number) { true }
@@ -2199,7 +2260,7 @@ describe Ibandit::IBAN do
2199
2260
  it "calls valid_branch_code? with an IBAN object" do
2200
2261
  expect(Ibandit.modulus_checker).
2201
2262
  to receive(:valid_branch_code?).
2202
- with(instance_of(Ibandit::IBAN))
2263
+ with(instance_of(described_class))
2203
2264
 
2204
2265
  iban.valid_local_modulus_check?
2205
2266
  end
@@ -2281,7 +2342,7 @@ describe Ibandit::IBAN do
2281
2342
  it "calls valid_account_number? with an IBAN object" do
2282
2343
  expect(Ibandit.modulus_checker).
2283
2344
  to receive(:valid_account_number?).
2284
- with(instance_of(Ibandit::IBAN))
2345
+ with(instance_of(described_class))
2285
2346
 
2286
2347
  iban.valid_local_modulus_check?
2287
2348
  end
@@ -2612,6 +2673,7 @@ describe Ibandit::IBAN do
2612
2673
  )
2613
2674
  iban.valid_australian_details?
2614
2675
  end
2676
+
2615
2677
  after { Ibandit.modulus_checker = nil }
2616
2678
 
2617
2679
  let(:valid_branch_code) { true }
@@ -2619,7 +2681,7 @@ describe Ibandit::IBAN do
2619
2681
  it "calls valid_branch_code? with an IBAN object" do
2620
2682
  expect(Ibandit.modulus_checker).
2621
2683
  to receive(:valid_branch_code?).
2622
- with(instance_of(Ibandit::IBAN))
2684
+ with(instance_of(described_class))
2623
2685
 
2624
2686
  iban.valid_australian_details?
2625
2687
  end
@@ -2738,6 +2800,7 @@ describe Ibandit::IBAN do
2738
2800
  )
2739
2801
  iban.valid_nz_details?
2740
2802
  end
2803
+
2741
2804
  after { Ibandit.modulus_checker = nil }
2742
2805
 
2743
2806
  let(:valid_branch_code) { true }
@@ -2745,7 +2808,7 @@ describe Ibandit::IBAN do
2745
2808
  it "calls valid_branch_code? with an IBAN object" do
2746
2809
  expect(Ibandit.modulus_checker).
2747
2810
  to receive(:valid_branch_code?).
2748
- with(instance_of(Ibandit::IBAN))
2811
+ with(instance_of(described_class))
2749
2812
 
2750
2813
  iban.valid_nz_details?
2751
2814
  end
@@ -2993,586 +3056,703 @@ describe Ibandit::IBAN do
2993
3056
 
2994
3057
  context "for a valid Albanian IBAN" do
2995
3058
  let(:iban_code) { "AL47 2121 1009 0000 0002 3569 8741" }
3059
+
2996
3060
  it { is_expected.to be_valid }
2997
3061
  end
2998
3062
 
2999
3063
  context "for a valid Andorran IBAN" do
3000
3064
  let(:iban_code) { "AD12 0001 2030 2003 5910 0100" }
3065
+
3001
3066
  it { is_expected.to be_valid }
3002
3067
  end
3003
3068
 
3004
3069
  context "for a valid Austrian IBAN" do
3005
3070
  let(:iban_code) { "AT61 1904 3002 3457 3201" }
3071
+
3006
3072
  it { is_expected.to be_valid }
3007
3073
  end
3008
3074
 
3009
3075
  context "for a valid Australian pseudo-IBAN" do
3010
3076
  let(:iban_code) { "AUZZ123456123456789" }
3077
+
3011
3078
  it { is_expected.to be_valid }
3012
3079
  end
3013
3080
 
3014
3081
  context "for an invalid Australian pseudo-IBAN" do
3015
3082
  let(:iban_code) { "AU99123456123456789" }
3083
+
3016
3084
  it { is_expected.to_not be_valid }
3017
3085
  end
3018
3086
 
3019
3087
  context "for a valid Azerbaijanian IBAN" do
3020
3088
  let(:iban_code) { "AZ21 NABZ 0000 0000 1370 1000 1944" }
3089
+
3021
3090
  it { is_expected.to be_valid }
3022
3091
  end
3023
3092
 
3024
3093
  context "for an invalid Azerbaijanian IBAN" do
3025
3094
  let(:iban_code) { "AZ91 NABZ 0000 0000 1370 1000 1944" }
3095
+
3026
3096
  it { is_expected.to_not be_valid }
3027
3097
  end
3028
3098
 
3029
3099
  context "for a valid Bahrainian IBAN" do
3030
3100
  let(:iban_code) { "BH67 BMAG 0000 1299 1234 56" }
3101
+
3031
3102
  it { is_expected.to be_valid }
3032
3103
  end
3033
3104
 
3034
3105
  context "for an invalid Bahrainian IBAN" do
3035
3106
  let(:iban_code) { "BH97 BMAG 0000 1299 1234 56" }
3107
+
3036
3108
  it { is_expected.to_not be_valid }
3037
3109
  end
3038
3110
 
3039
3111
  context "for a valid Belgian IBAN" do
3040
3112
  let(:iban_code) { "BE62 5100 0754 7061" }
3113
+
3041
3114
  it { is_expected.to be_valid }
3042
3115
  end
3043
3116
 
3044
3117
  context "for an invalid Belgian IBAN" do
3045
3118
  let(:iban_code) { "BE92 5100 0754 7061" }
3119
+
3046
3120
  it { is_expected.to_not be_valid }
3047
3121
  end
3048
3122
 
3049
3123
  context "for a valid Bosnian IBAN" do
3050
3124
  let(:iban_code) { "BA39 1290 0794 0102 8494" }
3125
+
3051
3126
  it { is_expected.to be_valid }
3052
3127
  end
3053
3128
 
3054
3129
  context "for an invalid Bosnian IBAN" do
3055
3130
  let(:iban_code) { "BA99 1290 0794 0102 8494" }
3131
+
3056
3132
  it { is_expected.to_not be_valid }
3057
3133
  end
3058
3134
 
3059
3135
  context "for a valid Bulgarian IBAN" do
3060
3136
  let(:iban_code) { "BG80 BNBG 9661 1020 3456 78" }
3137
+
3061
3138
  it { is_expected.to be_valid }
3062
3139
  end
3063
3140
 
3064
3141
  context "for an invalid Bulgarian IBAN" do
3065
3142
  let(:iban_code) { "BG90 BNBG 9661 1020 3456 78" }
3143
+
3066
3144
  it { is_expected.to_not be_valid }
3067
3145
  end
3068
3146
 
3069
3147
  context "for a valid Croatian IBAN" do
3070
3148
  let(:iban_code) { "HR12 1001 0051 8630 0016 0" }
3149
+
3071
3150
  it { is_expected.to be_valid }
3072
3151
  end
3073
3152
 
3074
3153
  context "for an invalid Croatian IBAN" do
3075
3154
  let(:iban_code) { "HR92 1001 0051 8630 0016 0" }
3155
+
3076
3156
  it { is_expected.to_not be_valid }
3077
3157
  end
3078
3158
 
3079
3159
  context "for a valid Cypriot IBAN" do
3080
3160
  let(:iban_code) { "CY17 0020 0128 0000 0012 0052 7600" }
3161
+
3081
3162
  it { is_expected.to be_valid }
3082
3163
  end
3083
3164
 
3084
3165
  context "for an invalid Cypriot IBAN" do
3085
3166
  let(:iban_code) { "CY97 0020 0128 0000 0012 0052 7600" }
3167
+
3086
3168
  it { is_expected.to_not be_valid }
3087
3169
  end
3088
3170
 
3089
3171
  context "for a valid Czech IBAN" do
3090
3172
  let(:iban_code) { "CZ65 0800 0000 1920 0014 5399" }
3173
+
3091
3174
  it { is_expected.to be_valid }
3092
3175
  end
3093
3176
 
3094
3177
  context "for an invalid Czech IBAN" do
3095
3178
  let(:iban_code) { "CZ95 0800 0000 1920 0014 5399" }
3179
+
3096
3180
  it { is_expected.to_not be_valid }
3097
3181
  end
3098
3182
 
3099
3183
  context "for a valid Danish IBAN" do
3100
3184
  let(:iban_code) { "DK50 0040 0440 1162 43" }
3185
+
3101
3186
  it { is_expected.to be_valid }
3102
3187
  end
3103
3188
 
3104
3189
  context "for an invalid Danish IBAN" do
3105
3190
  let(:iban_code) { "DK90 0040 0440 1162 43" }
3191
+
3106
3192
  it { is_expected.to_not be_valid }
3107
3193
  end
3108
3194
 
3109
3195
  context "for a valid Estonian IBAN" do
3110
3196
  let(:iban_code) { "EE38 2200 2210 2014 5685" }
3197
+
3111
3198
  it { is_expected.to be_valid }
3112
3199
  end
3113
3200
 
3114
3201
  context "for an invalid Estonian IBAN" do
3115
3202
  let(:iban_code) { "EE98 2200 2210 2014 5685" }
3203
+
3116
3204
  it { is_expected.to_not be_valid }
3117
3205
  end
3118
3206
 
3119
3207
  context "for a valid Faroe Islands IBAN" do
3120
3208
  let(:iban_code) { "FO97 5432 0388 8999 44" }
3209
+
3121
3210
  it { is_expected.to be_valid }
3122
3211
  end
3123
3212
 
3124
3213
  context "for an invalid Faroe Islands IBAN" do
3125
3214
  let(:iban_code) { "FO27 5432 0388 8999 44" }
3215
+
3126
3216
  it { is_expected.to_not be_valid }
3127
3217
  end
3128
3218
 
3129
3219
  context "for a valid Finnish IBAN" do
3130
3220
  let(:iban_code) { "FI21 1234 5600 0007 85" }
3221
+
3131
3222
  it { is_expected.to be_valid }
3132
3223
  end
3133
3224
 
3134
3225
  context "for an invalid Finnish IBAN" do
3135
3226
  let(:iban_code) { "FI91 1234 5600 0007 85" }
3227
+
3136
3228
  it { is_expected.to_not be_valid }
3137
3229
  end
3138
3230
 
3139
3231
  context "for a valid French IBAN" do
3140
3232
  let(:iban_code) { "FR14 2004 1010 0505 0001 3M02 606" }
3233
+
3141
3234
  it { is_expected.to be_valid }
3142
3235
  end
3143
3236
 
3144
3237
  context "for an invalid French IBAN" do
3145
3238
  let(:iban_code) { "FR94 2004 1010 0505 0001 3M02 606" }
3239
+
3146
3240
  it { is_expected.to_not be_valid }
3147
3241
  end
3148
3242
 
3149
3243
  context "for a valid Georgian IBAN" do
3150
3244
  let(:iban_code) { "GE29 NB00 0000 0101 9049 17" }
3245
+
3151
3246
  it { is_expected.to be_valid }
3152
3247
  end
3153
3248
 
3154
3249
  context "for an invalid Georgian IBAN" do
3155
3250
  let(:iban_code) { "GE99 NB00 0000 0101 9049 17" }
3251
+
3156
3252
  it { is_expected.to_not be_valid }
3157
3253
  end
3158
3254
 
3159
3255
  context "for a valid German IBAN" do
3160
3256
  let(:iban_code) { "DE89 3704 0044 0532 0130 00" }
3257
+
3161
3258
  it { is_expected.to be_valid }
3162
3259
  end
3163
3260
 
3164
3261
  context "for an invalid German IBAN" do
3165
3262
  let(:iban_code) { "DE99 3704 0044 0532 0130 00" }
3263
+
3166
3264
  it { is_expected.to_not be_valid }
3167
3265
  end
3168
3266
 
3169
3267
  context "for a valid Gibraltan IBAN" do
3170
3268
  let(:iban_code) { "GI75 NWBK 0000 0000 7099 453" }
3269
+
3171
3270
  it { is_expected.to be_valid }
3172
3271
  end
3173
3272
 
3174
3273
  context "for an invalid Gibraltan IBAN" do
3175
3274
  let(:iban_code) { "GI95 NWBK 0000 0000 7099 453" }
3275
+
3176
3276
  it { is_expected.to_not be_valid }
3177
3277
  end
3178
3278
 
3179
3279
  context "for a valid Greek IBAN" do
3180
3280
  let(:iban_code) { "GR16 0110 1250 0000 0001 2300 695" }
3281
+
3181
3282
  it { is_expected.to be_valid }
3182
3283
  end
3183
3284
 
3184
3285
  context "for an invalid Greek IBAN" do
3185
3286
  let(:iban_code) { "GR96 0110 1250 0000 0001 2300 695" }
3287
+
3186
3288
  it { is_expected.to_not be_valid }
3187
3289
  end
3188
3290
 
3189
3291
  context "for a valid Greenland IBAN" do
3190
3292
  let(:iban_code) { "GL56 0444 9876 5432 10" }
3293
+
3191
3294
  it { is_expected.to be_valid }
3192
3295
  end
3193
3296
 
3194
3297
  context "for an invalid Greenland IBAN" do
3195
3298
  let(:iban_code) { "GL96 0444 9876 5432 10" }
3299
+
3196
3300
  it { is_expected.to_not be_valid }
3197
3301
  end
3198
3302
 
3199
3303
  context "for a valid Hungarian IBAN" do
3200
3304
  let(:iban_code) { "HU42 1177 3016 1111 1018 0000 0000" }
3305
+
3201
3306
  it { is_expected.to be_valid }
3202
3307
  end
3203
3308
 
3204
3309
  context "for an invalid Hungarian IBAN" do
3205
3310
  let(:iban_code) { "HU92 1177 3016 1111 1018 0000 0000" }
3311
+
3206
3312
  it { is_expected.to_not be_valid }
3207
3313
  end
3208
3314
 
3209
3315
  context "for a valid Icelandic IBAN" do
3210
3316
  let(:iban_code) { "IS14 0159 2600 7654 5510 7303 39" }
3317
+
3211
3318
  it { is_expected.to be_valid }
3212
3319
  end
3213
3320
 
3214
3321
  context "for an invalid Icelandic IBAN" do
3215
3322
  let(:iban_code) { "IS94 0159 2600 7654 5510 7303 39" }
3323
+
3216
3324
  it { is_expected.to_not be_valid }
3217
3325
  end
3218
3326
 
3219
3327
  context "for a valid Irish IBAN" do
3220
3328
  let(:iban_code) { "IE29 AIBK 9311 5212 3456 78" }
3329
+
3221
3330
  it { is_expected.to be_valid }
3222
3331
  end
3223
3332
 
3224
3333
  context "for an invalid Irish IBAN" do
3225
3334
  let(:iban_code) { "IE99 AIBK 9311 5212 3456 78" }
3335
+
3226
3336
  it { is_expected.to_not be_valid }
3227
3337
  end
3228
3338
 
3229
3339
  context "for a valid Israeli IBAN" do
3230
3340
  let(:iban_code) { "IL62 0108 0000 0009 9999 999" }
3341
+
3231
3342
  it { is_expected.to be_valid }
3232
3343
  end
3233
3344
 
3234
3345
  context "for an invalid Israeli IBAN" do
3235
3346
  let(:iban_code) { "IL92 0108 0000 0009 9999 999" }
3347
+
3236
3348
  it { is_expected.to_not be_valid }
3237
3349
  end
3238
3350
 
3239
3351
  context "for a valid Italian IBAN" do
3240
3352
  let(:iban_code) { "IT40 S054 2811 1010 0000 0123 456" }
3353
+
3241
3354
  it { is_expected.to be_valid }
3242
3355
  end
3243
3356
 
3244
3357
  context "for an invalid Italian IBAN" do
3245
3358
  let(:iban_code) { "IT90 S054 2811 1010 0000 0123 456" }
3359
+
3246
3360
  it { is_expected.to_not be_valid }
3247
3361
  end
3248
3362
 
3249
3363
  context "for a valid Jordanian IBAN" do
3250
3364
  let(:iban_code) { "JO94 CBJO 0010 0000 0000 0131 0003 02" }
3365
+
3251
3366
  it { is_expected.to be_valid }
3252
3367
  end
3253
3368
 
3254
3369
  context "for an invalid Jordanian IBAN" do
3255
3370
  let(:iban_code) { "JO24 CBJO 0010 0000 0000 0131 0003 02" }
3371
+
3256
3372
  it { is_expected.to_not be_valid }
3257
3373
  end
3258
3374
 
3259
3375
  context "for a valid Kuwaiti IBAN" do
3260
3376
  let(:iban_code) { "KW81 CBKU 0000 0000 0000 1234 5601 01" }
3377
+
3261
3378
  it { is_expected.to be_valid }
3262
3379
  end
3263
3380
 
3264
3381
  context "for an invalid Kuwaiti IBAN" do
3265
3382
  let(:iban_code) { "KW91 CBKU 0000 0000 0000 1234 5601 01" }
3383
+
3266
3384
  it { is_expected.to_not be_valid }
3267
3385
  end
3268
3386
 
3269
3387
  context "for a valid Latvian IBAN" do
3270
3388
  let(:iban_code) { "LV80 BANK 0000 4351 9500 1" }
3389
+
3271
3390
  it { is_expected.to be_valid }
3272
3391
  end
3273
3392
 
3274
3393
  context "for an invalid Latvian IBAN" do
3275
3394
  let(:iban_code) { "LV90 BANK 0000 4351 9500 1" }
3395
+
3276
3396
  it { is_expected.to_not be_valid }
3277
3397
  end
3278
3398
 
3279
3399
  context "for a valid Lebanese IBAN" do
3280
3400
  let(:iban_code) { "LB62 0999 0000 0001 0019 0122 9114" }
3401
+
3281
3402
  it { is_expected.to be_valid }
3282
3403
  end
3283
3404
 
3284
3405
  context "for an invalid Lebanese IBAN" do
3285
3406
  let(:iban_code) { "LB92 0999 0000 0001 0019 0122 9114" }
3407
+
3286
3408
  it { is_expected.to_not be_valid }
3287
3409
  end
3288
3410
 
3289
3411
  context "for a valid Liechtensteinian IBAN" do
3290
3412
  let(:iban_code) { "LI21 0881 0000 2324 013A A" }
3413
+
3291
3414
  it { is_expected.to be_valid }
3292
3415
  end
3293
3416
 
3294
3417
  context "for an invalid Liechtensteinian IBAN" do
3295
3418
  let(:iban_code) { "LI91 0881 0000 2324 013A A" }
3419
+
3296
3420
  it { is_expected.to_not be_valid }
3297
3421
  end
3298
3422
 
3299
3423
  context "for a valid Lithuanian IBAN" do
3300
3424
  let(:iban_code) { "LT12 1000 0111 0100 1000" }
3425
+
3301
3426
  it { is_expected.to be_valid }
3302
3427
  end
3303
3428
 
3304
3429
  context "for an invalid Lithuanian IBAN" do
3305
3430
  let(:iban_code) { "LT92 1000 0111 0100 1000" }
3431
+
3306
3432
  it { is_expected.to_not be_valid }
3307
3433
  end
3308
3434
 
3309
3435
  context "for a valid Luxembourgian IBAN" do
3310
3436
  let(:iban_code) { "LU28 0019 4006 4475 0000" }
3437
+
3311
3438
  it { is_expected.to be_valid }
3312
3439
  end
3313
3440
 
3314
3441
  context "for an invalid Luxembourgian IBAN" do
3315
3442
  let(:iban_code) { "LU98 0019 4006 4475 0000" }
3443
+
3316
3444
  it { is_expected.to_not be_valid }
3317
3445
  end
3318
3446
 
3319
3447
  context "for a valid Macedonian IBAN" do
3320
3448
  let(:iban_code) { "MK072 5012 0000 0589 84" }
3449
+
3321
3450
  it { is_expected.to be_valid }
3322
3451
  end
3323
3452
 
3324
3453
  context "for an invalid Macedonian IBAN" do
3325
3454
  let(:iban_code) { "MK972 5012 0000 0589 84" }
3455
+
3326
3456
  it { is_expected.to_not be_valid }
3327
3457
  end
3328
3458
 
3329
3459
  context "for a valid Maltese IBAN" do
3330
3460
  let(:iban_code) { "MT84 MALT 0110 0001 2345 MTLC AST0 01S" }
3461
+
3331
3462
  it { is_expected.to be_valid }
3332
3463
  end
3333
3464
 
3334
3465
  context "for an invalid Maltese IBAN" do
3335
3466
  let(:iban_code) { "MT94 MALT 0110 0001 2345 MTLC AST0 01S" }
3467
+
3336
3468
  it { is_expected.to_not be_valid }
3337
3469
  end
3338
3470
 
3339
3471
  context "for a valid Maurititanian IBAN" do
3340
3472
  let(:iban_code) { "MU17 BOMM 0101 1010 3030 0200 000M UR" }
3473
+
3341
3474
  it { is_expected.to be_valid }
3342
3475
  end
3343
3476
 
3344
3477
  context "for an invalid Maurititanian IBAN" do
3345
3478
  let(:iban_code) { "MU97 BOMM 0101 1010 3030 0200 000M UR" }
3479
+
3346
3480
  it { is_expected.to_not be_valid }
3347
3481
  end
3348
3482
 
3349
3483
  context "for a valid Moldovan IBAN" do
3350
3484
  let(:iban_code) { "MD24 AG00 0225 1000 1310 4168" }
3485
+
3351
3486
  it { is_expected.to be_valid }
3352
3487
  end
3353
3488
 
3354
3489
  context "for an invalid Moldovan IBAN" do
3355
3490
  let(:iban_code) { "MD94 AG00 0225 1000 1310 4168" }
3491
+
3356
3492
  it { is_expected.to_not be_valid }
3357
3493
  end
3358
3494
 
3359
3495
  context "for a valid Monocan IBAN" do
3360
3496
  let(:iban_code) { "MC93 2005 2222 1001 1223 3M44 555" }
3497
+
3361
3498
  it { is_expected.to be_valid }
3362
3499
  end
3363
3500
 
3364
3501
  context "for an invalid Monocan IBAN" do
3365
3502
  let(:iban_code) { "MC23 2005 2222 1001 1223 3M44 555" }
3503
+
3366
3504
  it { is_expected.to_not be_valid }
3367
3505
  end
3368
3506
 
3369
3507
  context "for a valid Montenegrian IBAN" do
3370
3508
  let(:iban_code) { "ME25 5050 0001 2345 6789 51" }
3509
+
3371
3510
  it { is_expected.to be_valid }
3372
3511
  end
3373
3512
 
3374
3513
  context "for an invalid Montenegrian IBAN" do
3375
3514
  let(:iban_code) { "ME95 5050 0001 2345 6789 51" }
3515
+
3376
3516
  it { is_expected.to_not be_valid }
3377
3517
  end
3378
3518
 
3379
3519
  context "for a valid Dutch IBAN" do
3380
3520
  let(:iban_code) { "NL39 RABO 0300 0652 64" }
3521
+
3381
3522
  it { is_expected.to be_valid }
3382
3523
  end
3383
3524
 
3384
3525
  context "for an invalid Dutch IBAN" do
3385
3526
  let(:iban_code) { "NL99 RABO 0300 0652 64" }
3527
+
3386
3528
  it { is_expected.to_not be_valid }
3387
3529
  end
3388
3530
 
3389
3531
  context "for a valid Norwegian IBAN" do
3390
3532
  let(:iban_code) { "NO93 8601 1117 947" }
3533
+
3391
3534
  it { is_expected.to be_valid }
3392
3535
  end
3393
3536
 
3394
3537
  context "for an invalid Norwegian IBAN" do
3395
3538
  let(:iban_code) { "NO23 8601 1117 947" }
3539
+
3396
3540
  it { is_expected.to_not be_valid }
3397
3541
  end
3398
3542
 
3399
3543
  context "for a valid New Zealand pseudo-IBAN" do
3400
3544
  let(:iban_code) { "NZZZ5566667777777088" }
3545
+
3401
3546
  it { is_expected.to be_valid }
3402
3547
  end
3403
3548
 
3404
3549
  context "for an invalid New Zealand pseudo-IBAN" do
3405
3550
  let(:iban_code) { "NZZZ55666677777770888" }
3551
+
3406
3552
  it { is_expected.to_not be_valid }
3407
3553
  end
3408
3554
 
3409
3555
  context "for a valid Pakistani IBAN" do
3410
3556
  let(:iban_code) { "PK36 SCBL 0000 0011 2345 6702" }
3557
+
3411
3558
  it { is_expected.to be_valid }
3412
3559
  end
3413
3560
 
3414
3561
  context "for an invalid Pakistani IBAN" do
3415
3562
  let(:iban_code) { "PK96 SCBL 0000 0011 2345 6702" }
3563
+
3416
3564
  it { is_expected.to_not be_valid }
3417
3565
  end
3418
3566
 
3419
3567
  context "for a valid Polish IBAN" do
3420
3568
  let(:iban_code) { "PL60 1020 1026 0000 0422 7020 1111" }
3569
+
3421
3570
  it { is_expected.to be_valid }
3422
3571
  end
3423
3572
 
3424
3573
  context "for an invalid Polish IBAN" do
3425
3574
  let(:iban_code) { "PL90 1020 1026 0000 0422 7020 1111" }
3575
+
3426
3576
  it { is_expected.to_not be_valid }
3427
3577
  end
3428
3578
 
3429
3579
  context "for a valid Potuguese IBAN" do
3430
3580
  let(:iban_code) { "PT50 0002 0123 1234 5678 9015 4" }
3581
+
3431
3582
  it { is_expected.to be_valid }
3432
3583
  end
3433
3584
 
3434
3585
  context "for an invalid Potuguese IBAN" do
3435
3586
  let(:iban_code) { "PT90 0002 0123 1234 5678 9015 4" }
3587
+
3436
3588
  it { is_expected.to_not be_valid }
3437
3589
  end
3438
3590
 
3439
3591
  context "for a valid Qatari IBAN" do
3440
3592
  let(:iban_code) { "QA58 DOHB 0000 1234 5678 90AB CDEF G" }
3593
+
3441
3594
  it { is_expected.to be_valid }
3442
3595
  end
3443
3596
 
3444
3597
  context "for an invalid Qatari IBAN" do
3445
3598
  let(:iban_code) { "QA98 DOHB 0000 1234 5678 90AB CDEF G" }
3599
+
3446
3600
  it { is_expected.to_not be_valid }
3447
3601
  end
3448
3602
 
3449
3603
  context "for a valid Romanian IBAN" do
3450
3604
  let(:iban_code) { "RO49 AAAA 1B31 0075 9384 0000" }
3605
+
3451
3606
  it { is_expected.to be_valid }
3452
3607
  end
3453
3608
 
3454
3609
  context "for an invalid Romanian IBAN" do
3455
3610
  let(:iban_code) { "RO99 AAAA 1B31 0075 9384 0000" }
3611
+
3456
3612
  it { is_expected.to_not be_valid }
3457
3613
  end
3458
3614
 
3459
3615
  context "for a valid San Marinian IBAN" do
3460
3616
  let(:iban_code) { "SM86 U032 2509 8000 0000 0270 100" }
3617
+
3461
3618
  it { is_expected.to be_valid }
3462
3619
  end
3463
3620
 
3464
3621
  context "for an invalid San Marinian IBAN" do
3465
3622
  let(:iban_code) { "SM96 U032 2509 8000 0000 0270 100" }
3623
+
3466
3624
  it { is_expected.to_not be_valid }
3467
3625
  end
3468
3626
 
3469
3627
  context "for a valid Saudi IBAN" do
3470
3628
  let(:iban_code) { "SA03 8000 0000 6080 1016 7519" }
3629
+
3471
3630
  it { is_expected.to be_valid }
3472
3631
  end
3473
3632
 
3474
3633
  context "for an invalid Saudi IBAN" do
3475
3634
  let(:iban_code) { "SA93 8000 0000 6080 1016 7519" }
3635
+
3476
3636
  it { is_expected.to_not be_valid }
3477
3637
  end
3478
3638
 
3479
3639
  context "for a valid Serbian IBAN" do
3480
3640
  let(:iban_code) { "RS35 2600 0560 1001 6113 79" }
3641
+
3481
3642
  it { is_expected.to be_valid }
3482
3643
  end
3483
3644
 
3484
3645
  context "for an invalid Serbian IBAN" do
3485
3646
  let(:iban_code) { "RS95 2600 0560 1001 6113 79" }
3647
+
3486
3648
  it { is_expected.to_not be_valid }
3487
3649
  end
3488
3650
 
3489
3651
  context "for a valid Slovakian IBAN" do
3490
3652
  let(:iban_code) { "SK31 1200 0000 1987 4263 7541" }
3653
+
3491
3654
  it { is_expected.to be_valid }
3492
3655
  end
3493
3656
 
3494
3657
  context "for an invalid Slovakian IBAN" do
3495
3658
  let(:iban_code) { "SK91 1200 0000 1987 4263 7541" }
3659
+
3496
3660
  it { is_expected.to_not be_valid }
3497
3661
  end
3498
3662
 
3499
3663
  context "for a valid Slovenian IBAN" do
3500
3664
  let(:iban_code) { "SI56 1910 0000 0123 438" }
3665
+
3501
3666
  it { is_expected.to be_valid }
3502
3667
  end
3503
3668
 
3504
3669
  context "for an invalid Slovenian IBAN" do
3505
3670
  let(:iban_code) { "SI96 1910 0000 0123 438" }
3671
+
3506
3672
  it { is_expected.to_not be_valid }
3507
3673
  end
3508
3674
 
3509
3675
  context "for a valid Spanish IBAN" do
3510
3676
  let(:iban_code) { "ES80 2310 0001 1800 0001 2345" }
3677
+
3511
3678
  it { is_expected.to be_valid }
3512
3679
  end
3513
3680
 
3514
3681
  context "for an invalid Spanish IBAN" do
3515
3682
  let(:iban_code) { "ES90 2310 0001 1800 0001 2345" }
3683
+
3516
3684
  it { is_expected.to_not be_valid }
3517
3685
  end
3518
3686
 
3519
3687
  context "for a valid Swedish IBAN" do
3520
3688
  let(:iban_code) { "SE35 5000 0000 0549 1000 0003" }
3689
+
3521
3690
  it { is_expected.to be_valid }
3522
3691
  end
3523
3692
 
3524
3693
  context "for an invalid Swedish IBAN" do
3525
3694
  let(:iban_code) { "SE95 5000 0000 0549 1000 0003" }
3695
+
3526
3696
  it { is_expected.to_not be_valid }
3527
3697
  end
3528
3698
 
3529
3699
  context "for a valid Swiss IBAN" do
3530
3700
  let(:iban_code) { "CH93 0076 2011 6238 5295 7" }
3701
+
3531
3702
  it { is_expected.to be_valid }
3532
3703
  end
3533
3704
 
3534
3705
  context "for an invalid Swiss IBAN" do
3535
3706
  let(:iban_code) { "CH23 0076 2011 6238 5295 7" }
3707
+
3536
3708
  it { is_expected.to_not be_valid }
3537
3709
  end
3538
3710
 
3539
3711
  context "for a valid Tunisian IBAN" do
3540
3712
  let(:iban_code) { "TN59 1000 6035 1835 9847 8831" }
3713
+
3541
3714
  it { is_expected.to be_valid }
3542
3715
  end
3543
3716
 
3544
3717
  context "for an invalid Tunisian IBAN" do
3545
3718
  let(:iban_code) { "TN99 1000 6035 1835 9847 8831" }
3719
+
3546
3720
  it { is_expected.to_not be_valid }
3547
3721
  end
3548
3722
 
3549
3723
  context "for a valid Turkish IBAN" do
3550
3724
  let(:iban_code) { "TR33 0006 1005 1978 6457 8413 26" }
3725
+
3551
3726
  it { is_expected.to be_valid }
3552
3727
  end
3553
3728
 
3554
3729
  context "for an invalid Turkish IBAN" do
3555
3730
  let(:iban_code) { "TR93 0006 1005 1978 6457 8413 26" }
3731
+
3556
3732
  it { is_expected.to_not be_valid }
3557
3733
  end
3558
3734
 
3559
3735
  context "for a valid UAE IBAN" do
3560
3736
  let(:iban_code) { "AE07 0331 2345 6789 0123 456" }
3737
+
3561
3738
  it { is_expected.to be_valid }
3562
3739
  end
3563
3740
 
3564
3741
  context "for an invalid UAE IBAN" do
3565
3742
  let(:iban_code) { "AE97 0331 2345 6789 0123 456" }
3743
+
3566
3744
  it { is_expected.to_not be_valid }
3567
3745
  end
3568
3746
 
3569
3747
  context "for a valid UK IBAN" do
3570
3748
  let(:iban_code) { "GB82 WEST 1234 5698 7654 32" }
3749
+
3571
3750
  it { is_expected.to be_valid }
3572
3751
  end
3573
3752
 
3574
3753
  context "for an invalid UK IBAN" do
3575
3754
  let(:iban_code) { "GB92 WEST 1234 5698 7654 32" }
3755
+
3576
3756
  it { is_expected.to_not be_valid }
3577
3757
  end
3578
3758
  end
@@ -3580,61 +3760,73 @@ describe Ibandit::IBAN do
3580
3760
  describe "#local_check_digits" do
3581
3761
  context "with a Belgian IBAN" do
3582
3762
  let(:iban_code) { "BE62510007547061" }
3763
+
3583
3764
  its(:local_check_digits) { is_expected.to eq("61") }
3584
3765
  end
3585
3766
 
3586
3767
  context "with a French IBAN" do
3587
3768
  let(:iban_code) { "FR1234567890123456789012345" }
3769
+
3588
3770
  its(:local_check_digits) { is_expected.to eq("45") }
3589
3771
  end
3590
3772
 
3591
3773
  context "with a Monocan IBAN" do
3592
3774
  let(:iban_code) { "MC9320052222100112233M44555" }
3775
+
3593
3776
  its(:local_check_digits) { is_expected.to eq("55") }
3594
3777
  end
3595
3778
 
3596
3779
  context "with a Spanish IBAN" do
3597
3780
  let(:iban_code) { "ES1212345678911234567890" }
3781
+
3598
3782
  its(:local_check_digits) { is_expected.to eq("91") }
3599
3783
  end
3600
3784
 
3601
3785
  context "with an Italian IBAN" do
3602
3786
  let(:iban_code) { "IT12A1234567890123456789012" }
3787
+
3603
3788
  its(:local_check_digits) { is_expected.to eq("A") }
3604
3789
  end
3605
3790
 
3606
3791
  context "with an Estonian IBAN" do
3607
3792
  let(:iban_code) { "EE382200221020145685" }
3793
+
3608
3794
  its(:local_check_digits) { is_expected.to eq("5") }
3609
3795
  end
3610
3796
 
3611
3797
  context "with an Finnish IBAN" do
3612
3798
  let(:iban_code) { "FI2112345600000785" }
3799
+
3613
3800
  its(:local_check_digits) { is_expected.to eq("5") }
3614
3801
  end
3615
3802
 
3616
3803
  context "with an Portuguese IBAN" do
3617
3804
  let(:iban_code) { "PT50000201231234567890154" }
3805
+
3618
3806
  its(:local_check_digits) { is_expected.to eq("54") }
3619
3807
  end
3620
3808
 
3621
3809
  context "with a Norwegian IBAN" do
3622
3810
  let(:iban_code) { "NO9386011117947" }
3811
+
3623
3812
  its(:local_check_digits) { is_expected.to eq("7") }
3624
3813
  end
3625
3814
 
3626
3815
  context "with an Icelandic IBAN" do
3627
3816
  let(:iban_code) { "IS250311260024684606972049" }
3817
+
3628
3818
  its(:local_check_digits) { is_expected.to eq("4") }
3629
3819
  end
3630
3820
 
3631
3821
  context "with a Slovakian IBAN" do
3632
3822
  let(:iban_code) { "SK3112000000198742637541" }
3823
+
3633
3824
  its(:local_check_digits) { is_expected.to eq("9") }
3634
3825
  end
3635
3826
 
3636
3827
  context "with a Dutch IBAN" do
3637
3828
  let(:iban_code) { "NL91ABNA0417164300" }
3829
+
3638
3830
  its(:local_check_digits) { is_expected.to eq("0") }
3639
3831
  end
3640
3832
  end