ibandit 0.11.28 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -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 }
@@ -697,7 +715,7 @@ describe Ibandit::IBAN do
697
715
 
698
716
  context "and a 17 digit account number" do
699
717
  let(:account_number) { "01234567890123456" }
700
- let(:bank_code) { "965498456" }
718
+ let(:bank_code) { "026073150" }
701
719
 
702
720
  its(:country_code) { is_expected.to eq("US") }
703
721
  its(:bank_code) { is_expected.to eq(bank_code) }
@@ -706,8 +724,9 @@ describe Ibandit::IBAN do
706
724
  its(:swift_branch_code) { is_expected.to eq(nil) }
707
725
  its(:swift_account_number) { is_expected.to eq(account_number) }
708
726
  its(:swift_national_id) { is_expected.to eq(bank_code) }
727
+
709
728
  its(:pseudo_iban) do
710
- is_expected.to eq("USZZ96549845601234567890123456")
729
+ is_expected.to eq("USZZ02607315001234567890123456")
711
730
  end
712
731
 
713
732
  its(:iban) { is_expected.to be_nil }
@@ -717,18 +736,19 @@ describe Ibandit::IBAN do
717
736
  end
718
737
 
719
738
  context "when the IBAN was created from a US pseudo-IBAN" do
720
- let(:arg) { "USZZ96549845601234567890123456" }
739
+ let(:arg) { "USZZ02607315001234567890123456" }
721
740
 
722
741
  its(:country_code) { is_expected.to eq("US") }
723
- its(:bank_code) { is_expected.to eq("965498456") }
742
+ its(:bank_code) { is_expected.to eq("026073150") }
724
743
  its(:branch_code) { is_expected.to be_nil }
725
744
  its(:account_number) { is_expected.to eq("01234567890123456") }
726
- its(:swift_bank_code) { is_expected.to eq("965498456") }
745
+ its(:swift_bank_code) { is_expected.to eq("026073150") }
727
746
  its(:swift_branch_code) { is_expected.to eq(nil) }
728
747
  its(:swift_account_number) { is_expected.to eq("01234567890123456") }
729
- its(:swift_national_id) { is_expected.to eq("965498456") }
748
+ its(:swift_national_id) { is_expected.to eq("026073150") }
749
+
730
750
  its(:pseudo_iban) do
731
- is_expected.to eq("USZZ96549845601234567890123456")
751
+ is_expected.to eq("USZZ02607315001234567890123456")
732
752
  end
733
753
 
734
754
  its(:iban) { is_expected.to be_nil }
@@ -747,7 +767,7 @@ describe Ibandit::IBAN do
747
767
  end
748
768
 
749
769
  context "when the input pseudo-IBAN has an invalid US account_number" do
750
- let(:arg) { "USZZ965498456ABC01234567890123" }
770
+ let(:arg) { "USZZ026073150ABC01234567890123" }
751
771
 
752
772
  it "is invalid and has an error populated" do
753
773
  expect(subject.valid?).to eq(false)
@@ -768,6 +788,7 @@ describe Ibandit::IBAN do
768
788
 
769
789
  context "with the IBAN is nil" do
770
790
  let(:arg) { { country_code: "GB" } }
791
+
771
792
  its(:to_s) { is_expected.to_not be_nil }
772
793
  specify { expect(iban.to_s(:formatted)).to be_empty }
773
794
  end
@@ -780,11 +801,13 @@ describe Ibandit::IBAN do
780
801
  account_number: "0105723",
781
802
  }
782
803
  end
804
+
783
805
  specify { expect(iban.to_s).to eq("SE5412000000012810105723") }
784
806
  end
785
807
 
786
808
  context "with a Swedish pseudo-IBAN" do
787
809
  let(:arg) { "SEZZX1281XXX0105723" }
810
+
788
811
  specify { expect(iban.to_s).to eq("SE5412000000012810105723") }
789
812
  end
790
813
  end
@@ -802,7 +825,9 @@ describe Ibandit::IBAN do
802
825
 
803
826
  context "with an unknown country code" do
804
827
  before { iban.valid_country_code? }
828
+
805
829
  let(:iban_code) { "AA123456789123456" }
830
+
806
831
  it { is_expected.to eq(false) }
807
832
 
808
833
  context "locale en", locale: :en do
@@ -849,16 +874,19 @@ describe Ibandit::IBAN do
849
874
 
850
875
  context "with valid details" do
851
876
  let(:iban_code) { "GB82WEST12345698765432" }
877
+
852
878
  it { is_expected.to eq(true) }
853
879
 
854
880
  context "where the check digit is zero-padded" do
855
881
  let(:iban_code) { "GB06WEST12345698765442" }
882
+
856
883
  it { is_expected.to eq(true) }
857
884
  end
858
885
  end
859
886
 
860
887
  context "with invalid details" do
861
888
  let(:iban_code) { "GB12WEST12345698765432" }
889
+
862
890
  it { is_expected.to eq(false) }
863
891
 
864
892
  context "locale en", locale: :en do
@@ -972,6 +1000,7 @@ describe Ibandit::IBAN do
972
1000
 
973
1001
  context "with invalid characters" do
974
1002
  let(:iban_code) { "AA82-EST123456987654" }
1003
+
975
1004
  it { is_expected.to be_nil }
976
1005
 
977
1006
  it "does not set errors on the IBAN" do
@@ -982,6 +1011,7 @@ describe Ibandit::IBAN do
982
1011
 
983
1012
  context "with an empty IBAN" do
984
1013
  let(:iban_code) { "" }
1014
+
985
1015
  it { is_expected.to be_nil }
986
1016
 
987
1017
  it "does not set errors on the IBAN" do
@@ -1000,6 +1030,7 @@ describe Ibandit::IBAN do
1000
1030
 
1001
1031
  context "with invalid details" do
1002
1032
  let(:iban_code) { "GB82WEST123456987654" }
1033
+
1003
1034
  it { is_expected.to eq(false) }
1004
1035
 
1005
1036
  context "locale en", locale: :en do
@@ -1112,6 +1143,7 @@ describe Ibandit::IBAN do
1112
1143
 
1113
1144
  context "with an invalid country_code" do
1114
1145
  let(:iban_code) { "AA82WEST123456987654" }
1146
+
1115
1147
  it { is_expected.to be_nil }
1116
1148
 
1117
1149
  it "does not set errors on the IBAN" do
@@ -1130,6 +1162,7 @@ describe Ibandit::IBAN do
1130
1162
 
1131
1163
  context "with invalid details" do
1132
1164
  before { allow(iban).to receive(:swift_bank_code).and_return("WES") }
1165
+
1133
1166
  it { is_expected.to eq(false) }
1134
1167
 
1135
1168
  context "locale en", locale: :en do
@@ -1230,6 +1263,7 @@ describe Ibandit::IBAN do
1230
1263
 
1231
1264
  context "with an invalid country_code" do
1232
1265
  before { allow(iban).to receive(:country_code).and_return("AA") }
1266
+
1233
1267
  it { is_expected.to be_nil }
1234
1268
 
1235
1269
  it "does not set errors on the IBAN" do
@@ -1248,6 +1282,7 @@ describe Ibandit::IBAN do
1248
1282
 
1249
1283
  context "with invalid details" do
1250
1284
  before { allow(iban).to receive(:swift_branch_code).and_return("12345") }
1285
+
1251
1286
  it { is_expected.to eq(false) }
1252
1287
 
1253
1288
  context "locale en", locale: :en do
@@ -1348,6 +1383,7 @@ describe Ibandit::IBAN do
1348
1383
 
1349
1384
  context "without a branch code" do
1350
1385
  before { allow(iban).to receive(:swift_branch_code).and_return(nil) }
1386
+
1351
1387
  it { is_expected.to eq(false) }
1352
1388
 
1353
1389
  context "locale en", locale: :en do
@@ -1430,6 +1466,7 @@ describe Ibandit::IBAN do
1430
1466
 
1431
1467
  context "with an invalid country_code" do
1432
1468
  before { allow(iban).to receive(:country_code).and_return("AA") }
1469
+
1433
1470
  it { is_expected.to be_nil }
1434
1471
 
1435
1472
  it "does not set errors on the IBAN" do
@@ -1450,6 +1487,7 @@ describe Ibandit::IBAN do
1450
1487
  before do
1451
1488
  allow(iban).to receive(:swift_account_number).and_return("1234567")
1452
1489
  end
1490
+
1453
1491
  it { is_expected.to eq(false) }
1454
1492
 
1455
1493
  context "locale en", locale: :en do
@@ -1552,6 +1590,7 @@ describe Ibandit::IBAN do
1552
1590
 
1553
1591
  context "with an invalid country_code" do
1554
1592
  before { allow(iban).to receive(:country_code).and_return("AA") }
1593
+
1555
1594
  it { is_expected.to be_nil }
1556
1595
 
1557
1596
  it "does not set errors on the IBAN" do
@@ -1566,11 +1605,13 @@ describe Ibandit::IBAN do
1566
1605
 
1567
1606
  context "with valid details" do
1568
1607
  let(:iban_code) { "GB82WEST12345698765432" }
1608
+
1569
1609
  it { is_expected.to eq(true) }
1570
1610
  end
1571
1611
 
1572
1612
  context "with invalid details" do
1573
1613
  let(:iban_code) { "GB-123ABCD" }
1614
+
1574
1615
  it { is_expected.to eq(false) }
1575
1616
 
1576
1617
  context "locale en", locale: :en do
@@ -1670,11 +1711,13 @@ describe Ibandit::IBAN do
1670
1711
 
1671
1712
  context "with valid details" do
1672
1713
  let(:iban_code) { "GB82WEST12345698765432" }
1714
+
1673
1715
  it { is_expected.to eq(true) }
1674
1716
  end
1675
1717
 
1676
1718
  context "with invalid details" do
1677
1719
  let(:iban_code) { "GB82WEST12AAAAAA7654" }
1720
+
1678
1721
  it { is_expected.to eq(false) }
1679
1722
 
1680
1723
  context "locale en", locale: :en do
@@ -1768,6 +1811,7 @@ describe Ibandit::IBAN do
1768
1811
 
1769
1812
  context "with an invalid country_code" do
1770
1813
  let(:iban_code) { "AA82WEST12AAAAAA7654" }
1814
+
1771
1815
  it { is_expected.to be_nil }
1772
1816
 
1773
1817
  it "does not set errors on the IBAN" do
@@ -2129,7 +2173,9 @@ describe Ibandit::IBAN do
2129
2173
  valid_account_number?: valid_account_number,
2130
2174
  )
2131
2175
  end
2176
+
2132
2177
  after { Ibandit.modulus_checker = nil }
2178
+
2133
2179
  before { iban.valid_local_modulus_check? }
2134
2180
 
2135
2181
  context "with an invalid bank code" do
@@ -2141,7 +2187,7 @@ describe Ibandit::IBAN do
2141
2187
  it "calls valid_bank_code? with an IBAN object" do
2142
2188
  expect(Ibandit.modulus_checker).
2143
2189
  to receive(:valid_bank_code?).
2144
- with(instance_of(Ibandit::IBAN))
2190
+ with(instance_of(described_class))
2145
2191
 
2146
2192
  iban.valid_local_modulus_check?
2147
2193
  end
@@ -2202,8 +2248,11 @@ describe Ibandit::IBAN do
2202
2248
  context "with an invalid branch code" do
2203
2249
  let(:iban_code) { "GB60BARC20000055779911" }
2204
2250
  before { Ibandit.bic_finder = double(call: "BARCGB22XXX") }
2251
+
2205
2252
  after { Ibandit.bic_finder = nil }
2253
+
2206
2254
  before { iban.valid_local_modulus_check? }
2255
+
2207
2256
  let(:valid_bank_code) { true }
2208
2257
  let(:valid_branch_code) { false }
2209
2258
  let(:valid_account_number) { true }
@@ -2211,7 +2260,7 @@ describe Ibandit::IBAN do
2211
2260
  it "calls valid_branch_code? with an IBAN object" do
2212
2261
  expect(Ibandit.modulus_checker).
2213
2262
  to receive(:valid_branch_code?).
2214
- with(instance_of(Ibandit::IBAN))
2263
+ with(instance_of(described_class))
2215
2264
 
2216
2265
  iban.valid_local_modulus_check?
2217
2266
  end
@@ -2293,7 +2342,7 @@ describe Ibandit::IBAN do
2293
2342
  it "calls valid_account_number? with an IBAN object" do
2294
2343
  expect(Ibandit.modulus_checker).
2295
2344
  to receive(:valid_account_number?).
2296
- with(instance_of(Ibandit::IBAN))
2345
+ with(instance_of(described_class))
2297
2346
 
2298
2347
  iban.valid_local_modulus_check?
2299
2348
  end
@@ -2624,6 +2673,7 @@ describe Ibandit::IBAN do
2624
2673
  )
2625
2674
  iban.valid_australian_details?
2626
2675
  end
2676
+
2627
2677
  after { Ibandit.modulus_checker = nil }
2628
2678
 
2629
2679
  let(:valid_branch_code) { true }
@@ -2631,7 +2681,7 @@ describe Ibandit::IBAN do
2631
2681
  it "calls valid_branch_code? with an IBAN object" do
2632
2682
  expect(Ibandit.modulus_checker).
2633
2683
  to receive(:valid_branch_code?).
2634
- with(instance_of(Ibandit::IBAN))
2684
+ with(instance_of(described_class))
2635
2685
 
2636
2686
  iban.valid_australian_details?
2637
2687
  end
@@ -2750,6 +2800,7 @@ describe Ibandit::IBAN do
2750
2800
  )
2751
2801
  iban.valid_nz_details?
2752
2802
  end
2803
+
2753
2804
  after { Ibandit.modulus_checker = nil }
2754
2805
 
2755
2806
  let(:valid_branch_code) { true }
@@ -2757,7 +2808,7 @@ describe Ibandit::IBAN do
2757
2808
  it "calls valid_branch_code? with an IBAN object" do
2758
2809
  expect(Ibandit.modulus_checker).
2759
2810
  to receive(:valid_branch_code?).
2760
- with(instance_of(Ibandit::IBAN))
2811
+ with(instance_of(described_class))
2761
2812
 
2762
2813
  iban.valid_nz_details?
2763
2814
  end
@@ -3005,586 +3056,703 @@ describe Ibandit::IBAN do
3005
3056
 
3006
3057
  context "for a valid Albanian IBAN" do
3007
3058
  let(:iban_code) { "AL47 2121 1009 0000 0002 3569 8741" }
3059
+
3008
3060
  it { is_expected.to be_valid }
3009
3061
  end
3010
3062
 
3011
3063
  context "for a valid Andorran IBAN" do
3012
3064
  let(:iban_code) { "AD12 0001 2030 2003 5910 0100" }
3065
+
3013
3066
  it { is_expected.to be_valid }
3014
3067
  end
3015
3068
 
3016
3069
  context "for a valid Austrian IBAN" do
3017
3070
  let(:iban_code) { "AT61 1904 3002 3457 3201" }
3071
+
3018
3072
  it { is_expected.to be_valid }
3019
3073
  end
3020
3074
 
3021
3075
  context "for a valid Australian pseudo-IBAN" do
3022
3076
  let(:iban_code) { "AUZZ123456123456789" }
3077
+
3023
3078
  it { is_expected.to be_valid }
3024
3079
  end
3025
3080
 
3026
3081
  context "for an invalid Australian pseudo-IBAN" do
3027
3082
  let(:iban_code) { "AU99123456123456789" }
3083
+
3028
3084
  it { is_expected.to_not be_valid }
3029
3085
  end
3030
3086
 
3031
3087
  context "for a valid Azerbaijanian IBAN" do
3032
3088
  let(:iban_code) { "AZ21 NABZ 0000 0000 1370 1000 1944" }
3089
+
3033
3090
  it { is_expected.to be_valid }
3034
3091
  end
3035
3092
 
3036
3093
  context "for an invalid Azerbaijanian IBAN" do
3037
3094
  let(:iban_code) { "AZ91 NABZ 0000 0000 1370 1000 1944" }
3095
+
3038
3096
  it { is_expected.to_not be_valid }
3039
3097
  end
3040
3098
 
3041
3099
  context "for a valid Bahrainian IBAN" do
3042
3100
  let(:iban_code) { "BH67 BMAG 0000 1299 1234 56" }
3101
+
3043
3102
  it { is_expected.to be_valid }
3044
3103
  end
3045
3104
 
3046
3105
  context "for an invalid Bahrainian IBAN" do
3047
3106
  let(:iban_code) { "BH97 BMAG 0000 1299 1234 56" }
3107
+
3048
3108
  it { is_expected.to_not be_valid }
3049
3109
  end
3050
3110
 
3051
3111
  context "for a valid Belgian IBAN" do
3052
3112
  let(:iban_code) { "BE62 5100 0754 7061" }
3113
+
3053
3114
  it { is_expected.to be_valid }
3054
3115
  end
3055
3116
 
3056
3117
  context "for an invalid Belgian IBAN" do
3057
3118
  let(:iban_code) { "BE92 5100 0754 7061" }
3119
+
3058
3120
  it { is_expected.to_not be_valid }
3059
3121
  end
3060
3122
 
3061
3123
  context "for a valid Bosnian IBAN" do
3062
3124
  let(:iban_code) { "BA39 1290 0794 0102 8494" }
3125
+
3063
3126
  it { is_expected.to be_valid }
3064
3127
  end
3065
3128
 
3066
3129
  context "for an invalid Bosnian IBAN" do
3067
3130
  let(:iban_code) { "BA99 1290 0794 0102 8494" }
3131
+
3068
3132
  it { is_expected.to_not be_valid }
3069
3133
  end
3070
3134
 
3071
3135
  context "for a valid Bulgarian IBAN" do
3072
3136
  let(:iban_code) { "BG80 BNBG 9661 1020 3456 78" }
3137
+
3073
3138
  it { is_expected.to be_valid }
3074
3139
  end
3075
3140
 
3076
3141
  context "for an invalid Bulgarian IBAN" do
3077
3142
  let(:iban_code) { "BG90 BNBG 9661 1020 3456 78" }
3143
+
3078
3144
  it { is_expected.to_not be_valid }
3079
3145
  end
3080
3146
 
3081
3147
  context "for a valid Croatian IBAN" do
3082
3148
  let(:iban_code) { "HR12 1001 0051 8630 0016 0" }
3149
+
3083
3150
  it { is_expected.to be_valid }
3084
3151
  end
3085
3152
 
3086
3153
  context "for an invalid Croatian IBAN" do
3087
3154
  let(:iban_code) { "HR92 1001 0051 8630 0016 0" }
3155
+
3088
3156
  it { is_expected.to_not be_valid }
3089
3157
  end
3090
3158
 
3091
3159
  context "for a valid Cypriot IBAN" do
3092
3160
  let(:iban_code) { "CY17 0020 0128 0000 0012 0052 7600" }
3161
+
3093
3162
  it { is_expected.to be_valid }
3094
3163
  end
3095
3164
 
3096
3165
  context "for an invalid Cypriot IBAN" do
3097
3166
  let(:iban_code) { "CY97 0020 0128 0000 0012 0052 7600" }
3167
+
3098
3168
  it { is_expected.to_not be_valid }
3099
3169
  end
3100
3170
 
3101
3171
  context "for a valid Czech IBAN" do
3102
3172
  let(:iban_code) { "CZ65 0800 0000 1920 0014 5399" }
3173
+
3103
3174
  it { is_expected.to be_valid }
3104
3175
  end
3105
3176
 
3106
3177
  context "for an invalid Czech IBAN" do
3107
3178
  let(:iban_code) { "CZ95 0800 0000 1920 0014 5399" }
3179
+
3108
3180
  it { is_expected.to_not be_valid }
3109
3181
  end
3110
3182
 
3111
3183
  context "for a valid Danish IBAN" do
3112
3184
  let(:iban_code) { "DK50 0040 0440 1162 43" }
3185
+
3113
3186
  it { is_expected.to be_valid }
3114
3187
  end
3115
3188
 
3116
3189
  context "for an invalid Danish IBAN" do
3117
3190
  let(:iban_code) { "DK90 0040 0440 1162 43" }
3191
+
3118
3192
  it { is_expected.to_not be_valid }
3119
3193
  end
3120
3194
 
3121
3195
  context "for a valid Estonian IBAN" do
3122
3196
  let(:iban_code) { "EE38 2200 2210 2014 5685" }
3197
+
3123
3198
  it { is_expected.to be_valid }
3124
3199
  end
3125
3200
 
3126
3201
  context "for an invalid Estonian IBAN" do
3127
3202
  let(:iban_code) { "EE98 2200 2210 2014 5685" }
3203
+
3128
3204
  it { is_expected.to_not be_valid }
3129
3205
  end
3130
3206
 
3131
3207
  context "for a valid Faroe Islands IBAN" do
3132
3208
  let(:iban_code) { "FO97 5432 0388 8999 44" }
3209
+
3133
3210
  it { is_expected.to be_valid }
3134
3211
  end
3135
3212
 
3136
3213
  context "for an invalid Faroe Islands IBAN" do
3137
3214
  let(:iban_code) { "FO27 5432 0388 8999 44" }
3215
+
3138
3216
  it { is_expected.to_not be_valid }
3139
3217
  end
3140
3218
 
3141
3219
  context "for a valid Finnish IBAN" do
3142
3220
  let(:iban_code) { "FI21 1234 5600 0007 85" }
3221
+
3143
3222
  it { is_expected.to be_valid }
3144
3223
  end
3145
3224
 
3146
3225
  context "for an invalid Finnish IBAN" do
3147
3226
  let(:iban_code) { "FI91 1234 5600 0007 85" }
3227
+
3148
3228
  it { is_expected.to_not be_valid }
3149
3229
  end
3150
3230
 
3151
3231
  context "for a valid French IBAN" do
3152
3232
  let(:iban_code) { "FR14 2004 1010 0505 0001 3M02 606" }
3233
+
3153
3234
  it { is_expected.to be_valid }
3154
3235
  end
3155
3236
 
3156
3237
  context "for an invalid French IBAN" do
3157
3238
  let(:iban_code) { "FR94 2004 1010 0505 0001 3M02 606" }
3239
+
3158
3240
  it { is_expected.to_not be_valid }
3159
3241
  end
3160
3242
 
3161
3243
  context "for a valid Georgian IBAN" do
3162
3244
  let(:iban_code) { "GE29 NB00 0000 0101 9049 17" }
3245
+
3163
3246
  it { is_expected.to be_valid }
3164
3247
  end
3165
3248
 
3166
3249
  context "for an invalid Georgian IBAN" do
3167
3250
  let(:iban_code) { "GE99 NB00 0000 0101 9049 17" }
3251
+
3168
3252
  it { is_expected.to_not be_valid }
3169
3253
  end
3170
3254
 
3171
3255
  context "for a valid German IBAN" do
3172
3256
  let(:iban_code) { "DE89 3704 0044 0532 0130 00" }
3257
+
3173
3258
  it { is_expected.to be_valid }
3174
3259
  end
3175
3260
 
3176
3261
  context "for an invalid German IBAN" do
3177
3262
  let(:iban_code) { "DE99 3704 0044 0532 0130 00" }
3263
+
3178
3264
  it { is_expected.to_not be_valid }
3179
3265
  end
3180
3266
 
3181
3267
  context "for a valid Gibraltan IBAN" do
3182
3268
  let(:iban_code) { "GI75 NWBK 0000 0000 7099 453" }
3269
+
3183
3270
  it { is_expected.to be_valid }
3184
3271
  end
3185
3272
 
3186
3273
  context "for an invalid Gibraltan IBAN" do
3187
3274
  let(:iban_code) { "GI95 NWBK 0000 0000 7099 453" }
3275
+
3188
3276
  it { is_expected.to_not be_valid }
3189
3277
  end
3190
3278
 
3191
3279
  context "for a valid Greek IBAN" do
3192
3280
  let(:iban_code) { "GR16 0110 1250 0000 0001 2300 695" }
3281
+
3193
3282
  it { is_expected.to be_valid }
3194
3283
  end
3195
3284
 
3196
3285
  context "for an invalid Greek IBAN" do
3197
3286
  let(:iban_code) { "GR96 0110 1250 0000 0001 2300 695" }
3287
+
3198
3288
  it { is_expected.to_not be_valid }
3199
3289
  end
3200
3290
 
3201
3291
  context "for a valid Greenland IBAN" do
3202
3292
  let(:iban_code) { "GL56 0444 9876 5432 10" }
3293
+
3203
3294
  it { is_expected.to be_valid }
3204
3295
  end
3205
3296
 
3206
3297
  context "for an invalid Greenland IBAN" do
3207
3298
  let(:iban_code) { "GL96 0444 9876 5432 10" }
3299
+
3208
3300
  it { is_expected.to_not be_valid }
3209
3301
  end
3210
3302
 
3211
3303
  context "for a valid Hungarian IBAN" do
3212
3304
  let(:iban_code) { "HU42 1177 3016 1111 1018 0000 0000" }
3305
+
3213
3306
  it { is_expected.to be_valid }
3214
3307
  end
3215
3308
 
3216
3309
  context "for an invalid Hungarian IBAN" do
3217
3310
  let(:iban_code) { "HU92 1177 3016 1111 1018 0000 0000" }
3311
+
3218
3312
  it { is_expected.to_not be_valid }
3219
3313
  end
3220
3314
 
3221
3315
  context "for a valid Icelandic IBAN" do
3222
3316
  let(:iban_code) { "IS14 0159 2600 7654 5510 7303 39" }
3317
+
3223
3318
  it { is_expected.to be_valid }
3224
3319
  end
3225
3320
 
3226
3321
  context "for an invalid Icelandic IBAN" do
3227
3322
  let(:iban_code) { "IS94 0159 2600 7654 5510 7303 39" }
3323
+
3228
3324
  it { is_expected.to_not be_valid }
3229
3325
  end
3230
3326
 
3231
3327
  context "for a valid Irish IBAN" do
3232
3328
  let(:iban_code) { "IE29 AIBK 9311 5212 3456 78" }
3329
+
3233
3330
  it { is_expected.to be_valid }
3234
3331
  end
3235
3332
 
3236
3333
  context "for an invalid Irish IBAN" do
3237
3334
  let(:iban_code) { "IE99 AIBK 9311 5212 3456 78" }
3335
+
3238
3336
  it { is_expected.to_not be_valid }
3239
3337
  end
3240
3338
 
3241
3339
  context "for a valid Israeli IBAN" do
3242
3340
  let(:iban_code) { "IL62 0108 0000 0009 9999 999" }
3341
+
3243
3342
  it { is_expected.to be_valid }
3244
3343
  end
3245
3344
 
3246
3345
  context "for an invalid Israeli IBAN" do
3247
3346
  let(:iban_code) { "IL92 0108 0000 0009 9999 999" }
3347
+
3248
3348
  it { is_expected.to_not be_valid }
3249
3349
  end
3250
3350
 
3251
3351
  context "for a valid Italian IBAN" do
3252
3352
  let(:iban_code) { "IT40 S054 2811 1010 0000 0123 456" }
3353
+
3253
3354
  it { is_expected.to be_valid }
3254
3355
  end
3255
3356
 
3256
3357
  context "for an invalid Italian IBAN" do
3257
3358
  let(:iban_code) { "IT90 S054 2811 1010 0000 0123 456" }
3359
+
3258
3360
  it { is_expected.to_not be_valid }
3259
3361
  end
3260
3362
 
3261
3363
  context "for a valid Jordanian IBAN" do
3262
3364
  let(:iban_code) { "JO94 CBJO 0010 0000 0000 0131 0003 02" }
3365
+
3263
3366
  it { is_expected.to be_valid }
3264
3367
  end
3265
3368
 
3266
3369
  context "for an invalid Jordanian IBAN" do
3267
3370
  let(:iban_code) { "JO24 CBJO 0010 0000 0000 0131 0003 02" }
3371
+
3268
3372
  it { is_expected.to_not be_valid }
3269
3373
  end
3270
3374
 
3271
3375
  context "for a valid Kuwaiti IBAN" do
3272
3376
  let(:iban_code) { "KW81 CBKU 0000 0000 0000 1234 5601 01" }
3377
+
3273
3378
  it { is_expected.to be_valid }
3274
3379
  end
3275
3380
 
3276
3381
  context "for an invalid Kuwaiti IBAN" do
3277
3382
  let(:iban_code) { "KW91 CBKU 0000 0000 0000 1234 5601 01" }
3383
+
3278
3384
  it { is_expected.to_not be_valid }
3279
3385
  end
3280
3386
 
3281
3387
  context "for a valid Latvian IBAN" do
3282
3388
  let(:iban_code) { "LV80 BANK 0000 4351 9500 1" }
3389
+
3283
3390
  it { is_expected.to be_valid }
3284
3391
  end
3285
3392
 
3286
3393
  context "for an invalid Latvian IBAN" do
3287
3394
  let(:iban_code) { "LV90 BANK 0000 4351 9500 1" }
3395
+
3288
3396
  it { is_expected.to_not be_valid }
3289
3397
  end
3290
3398
 
3291
3399
  context "for a valid Lebanese IBAN" do
3292
3400
  let(:iban_code) { "LB62 0999 0000 0001 0019 0122 9114" }
3401
+
3293
3402
  it { is_expected.to be_valid }
3294
3403
  end
3295
3404
 
3296
3405
  context "for an invalid Lebanese IBAN" do
3297
3406
  let(:iban_code) { "LB92 0999 0000 0001 0019 0122 9114" }
3407
+
3298
3408
  it { is_expected.to_not be_valid }
3299
3409
  end
3300
3410
 
3301
3411
  context "for a valid Liechtensteinian IBAN" do
3302
3412
  let(:iban_code) { "LI21 0881 0000 2324 013A A" }
3413
+
3303
3414
  it { is_expected.to be_valid }
3304
3415
  end
3305
3416
 
3306
3417
  context "for an invalid Liechtensteinian IBAN" do
3307
3418
  let(:iban_code) { "LI91 0881 0000 2324 013A A" }
3419
+
3308
3420
  it { is_expected.to_not be_valid }
3309
3421
  end
3310
3422
 
3311
3423
  context "for a valid Lithuanian IBAN" do
3312
3424
  let(:iban_code) { "LT12 1000 0111 0100 1000" }
3425
+
3313
3426
  it { is_expected.to be_valid }
3314
3427
  end
3315
3428
 
3316
3429
  context "for an invalid Lithuanian IBAN" do
3317
3430
  let(:iban_code) { "LT92 1000 0111 0100 1000" }
3431
+
3318
3432
  it { is_expected.to_not be_valid }
3319
3433
  end
3320
3434
 
3321
3435
  context "for a valid Luxembourgian IBAN" do
3322
3436
  let(:iban_code) { "LU28 0019 4006 4475 0000" }
3437
+
3323
3438
  it { is_expected.to be_valid }
3324
3439
  end
3325
3440
 
3326
3441
  context "for an invalid Luxembourgian IBAN" do
3327
3442
  let(:iban_code) { "LU98 0019 4006 4475 0000" }
3443
+
3328
3444
  it { is_expected.to_not be_valid }
3329
3445
  end
3330
3446
 
3331
3447
  context "for a valid Macedonian IBAN" do
3332
3448
  let(:iban_code) { "MK072 5012 0000 0589 84" }
3449
+
3333
3450
  it { is_expected.to be_valid }
3334
3451
  end
3335
3452
 
3336
3453
  context "for an invalid Macedonian IBAN" do
3337
3454
  let(:iban_code) { "MK972 5012 0000 0589 84" }
3455
+
3338
3456
  it { is_expected.to_not be_valid }
3339
3457
  end
3340
3458
 
3341
3459
  context "for a valid Maltese IBAN" do
3342
3460
  let(:iban_code) { "MT84 MALT 0110 0001 2345 MTLC AST0 01S" }
3461
+
3343
3462
  it { is_expected.to be_valid }
3344
3463
  end
3345
3464
 
3346
3465
  context "for an invalid Maltese IBAN" do
3347
3466
  let(:iban_code) { "MT94 MALT 0110 0001 2345 MTLC AST0 01S" }
3467
+
3348
3468
  it { is_expected.to_not be_valid }
3349
3469
  end
3350
3470
 
3351
3471
  context "for a valid Maurititanian IBAN" do
3352
3472
  let(:iban_code) { "MU17 BOMM 0101 1010 3030 0200 000M UR" }
3473
+
3353
3474
  it { is_expected.to be_valid }
3354
3475
  end
3355
3476
 
3356
3477
  context "for an invalid Maurititanian IBAN" do
3357
3478
  let(:iban_code) { "MU97 BOMM 0101 1010 3030 0200 000M UR" }
3479
+
3358
3480
  it { is_expected.to_not be_valid }
3359
3481
  end
3360
3482
 
3361
3483
  context "for a valid Moldovan IBAN" do
3362
3484
  let(:iban_code) { "MD24 AG00 0225 1000 1310 4168" }
3485
+
3363
3486
  it { is_expected.to be_valid }
3364
3487
  end
3365
3488
 
3366
3489
  context "for an invalid Moldovan IBAN" do
3367
3490
  let(:iban_code) { "MD94 AG00 0225 1000 1310 4168" }
3491
+
3368
3492
  it { is_expected.to_not be_valid }
3369
3493
  end
3370
3494
 
3371
3495
  context "for a valid Monocan IBAN" do
3372
3496
  let(:iban_code) { "MC93 2005 2222 1001 1223 3M44 555" }
3497
+
3373
3498
  it { is_expected.to be_valid }
3374
3499
  end
3375
3500
 
3376
3501
  context "for an invalid Monocan IBAN" do
3377
3502
  let(:iban_code) { "MC23 2005 2222 1001 1223 3M44 555" }
3503
+
3378
3504
  it { is_expected.to_not be_valid }
3379
3505
  end
3380
3506
 
3381
3507
  context "for a valid Montenegrian IBAN" do
3382
3508
  let(:iban_code) { "ME25 5050 0001 2345 6789 51" }
3509
+
3383
3510
  it { is_expected.to be_valid }
3384
3511
  end
3385
3512
 
3386
3513
  context "for an invalid Montenegrian IBAN" do
3387
3514
  let(:iban_code) { "ME95 5050 0001 2345 6789 51" }
3515
+
3388
3516
  it { is_expected.to_not be_valid }
3389
3517
  end
3390
3518
 
3391
3519
  context "for a valid Dutch IBAN" do
3392
3520
  let(:iban_code) { "NL39 RABO 0300 0652 64" }
3521
+
3393
3522
  it { is_expected.to be_valid }
3394
3523
  end
3395
3524
 
3396
3525
  context "for an invalid Dutch IBAN" do
3397
3526
  let(:iban_code) { "NL99 RABO 0300 0652 64" }
3527
+
3398
3528
  it { is_expected.to_not be_valid }
3399
3529
  end
3400
3530
 
3401
3531
  context "for a valid Norwegian IBAN" do
3402
3532
  let(:iban_code) { "NO93 8601 1117 947" }
3533
+
3403
3534
  it { is_expected.to be_valid }
3404
3535
  end
3405
3536
 
3406
3537
  context "for an invalid Norwegian IBAN" do
3407
3538
  let(:iban_code) { "NO23 8601 1117 947" }
3539
+
3408
3540
  it { is_expected.to_not be_valid }
3409
3541
  end
3410
3542
 
3411
3543
  context "for a valid New Zealand pseudo-IBAN" do
3412
3544
  let(:iban_code) { "NZZZ5566667777777088" }
3545
+
3413
3546
  it { is_expected.to be_valid }
3414
3547
  end
3415
3548
 
3416
3549
  context "for an invalid New Zealand pseudo-IBAN" do
3417
3550
  let(:iban_code) { "NZZZ55666677777770888" }
3551
+
3418
3552
  it { is_expected.to_not be_valid }
3419
3553
  end
3420
3554
 
3421
3555
  context "for a valid Pakistani IBAN" do
3422
3556
  let(:iban_code) { "PK36 SCBL 0000 0011 2345 6702" }
3557
+
3423
3558
  it { is_expected.to be_valid }
3424
3559
  end
3425
3560
 
3426
3561
  context "for an invalid Pakistani IBAN" do
3427
3562
  let(:iban_code) { "PK96 SCBL 0000 0011 2345 6702" }
3563
+
3428
3564
  it { is_expected.to_not be_valid }
3429
3565
  end
3430
3566
 
3431
3567
  context "for a valid Polish IBAN" do
3432
3568
  let(:iban_code) { "PL60 1020 1026 0000 0422 7020 1111" }
3569
+
3433
3570
  it { is_expected.to be_valid }
3434
3571
  end
3435
3572
 
3436
3573
  context "for an invalid Polish IBAN" do
3437
3574
  let(:iban_code) { "PL90 1020 1026 0000 0422 7020 1111" }
3575
+
3438
3576
  it { is_expected.to_not be_valid }
3439
3577
  end
3440
3578
 
3441
3579
  context "for a valid Potuguese IBAN" do
3442
3580
  let(:iban_code) { "PT50 0002 0123 1234 5678 9015 4" }
3581
+
3443
3582
  it { is_expected.to be_valid }
3444
3583
  end
3445
3584
 
3446
3585
  context "for an invalid Potuguese IBAN" do
3447
3586
  let(:iban_code) { "PT90 0002 0123 1234 5678 9015 4" }
3587
+
3448
3588
  it { is_expected.to_not be_valid }
3449
3589
  end
3450
3590
 
3451
3591
  context "for a valid Qatari IBAN" do
3452
3592
  let(:iban_code) { "QA58 DOHB 0000 1234 5678 90AB CDEF G" }
3593
+
3453
3594
  it { is_expected.to be_valid }
3454
3595
  end
3455
3596
 
3456
3597
  context "for an invalid Qatari IBAN" do
3457
3598
  let(:iban_code) { "QA98 DOHB 0000 1234 5678 90AB CDEF G" }
3599
+
3458
3600
  it { is_expected.to_not be_valid }
3459
3601
  end
3460
3602
 
3461
3603
  context "for a valid Romanian IBAN" do
3462
3604
  let(:iban_code) { "RO49 AAAA 1B31 0075 9384 0000" }
3605
+
3463
3606
  it { is_expected.to be_valid }
3464
3607
  end
3465
3608
 
3466
3609
  context "for an invalid Romanian IBAN" do
3467
3610
  let(:iban_code) { "RO99 AAAA 1B31 0075 9384 0000" }
3611
+
3468
3612
  it { is_expected.to_not be_valid }
3469
3613
  end
3470
3614
 
3471
3615
  context "for a valid San Marinian IBAN" do
3472
3616
  let(:iban_code) { "SM86 U032 2509 8000 0000 0270 100" }
3617
+
3473
3618
  it { is_expected.to be_valid }
3474
3619
  end
3475
3620
 
3476
3621
  context "for an invalid San Marinian IBAN" do
3477
3622
  let(:iban_code) { "SM96 U032 2509 8000 0000 0270 100" }
3623
+
3478
3624
  it { is_expected.to_not be_valid }
3479
3625
  end
3480
3626
 
3481
3627
  context "for a valid Saudi IBAN" do
3482
3628
  let(:iban_code) { "SA03 8000 0000 6080 1016 7519" }
3629
+
3483
3630
  it { is_expected.to be_valid }
3484
3631
  end
3485
3632
 
3486
3633
  context "for an invalid Saudi IBAN" do
3487
3634
  let(:iban_code) { "SA93 8000 0000 6080 1016 7519" }
3635
+
3488
3636
  it { is_expected.to_not be_valid }
3489
3637
  end
3490
3638
 
3491
3639
  context "for a valid Serbian IBAN" do
3492
3640
  let(:iban_code) { "RS35 2600 0560 1001 6113 79" }
3641
+
3493
3642
  it { is_expected.to be_valid }
3494
3643
  end
3495
3644
 
3496
3645
  context "for an invalid Serbian IBAN" do
3497
3646
  let(:iban_code) { "RS95 2600 0560 1001 6113 79" }
3647
+
3498
3648
  it { is_expected.to_not be_valid }
3499
3649
  end
3500
3650
 
3501
3651
  context "for a valid Slovakian IBAN" do
3502
3652
  let(:iban_code) { "SK31 1200 0000 1987 4263 7541" }
3653
+
3503
3654
  it { is_expected.to be_valid }
3504
3655
  end
3505
3656
 
3506
3657
  context "for an invalid Slovakian IBAN" do
3507
3658
  let(:iban_code) { "SK91 1200 0000 1987 4263 7541" }
3659
+
3508
3660
  it { is_expected.to_not be_valid }
3509
3661
  end
3510
3662
 
3511
3663
  context "for a valid Slovenian IBAN" do
3512
3664
  let(:iban_code) { "SI56 1910 0000 0123 438" }
3665
+
3513
3666
  it { is_expected.to be_valid }
3514
3667
  end
3515
3668
 
3516
3669
  context "for an invalid Slovenian IBAN" do
3517
3670
  let(:iban_code) { "SI96 1910 0000 0123 438" }
3671
+
3518
3672
  it { is_expected.to_not be_valid }
3519
3673
  end
3520
3674
 
3521
3675
  context "for a valid Spanish IBAN" do
3522
3676
  let(:iban_code) { "ES80 2310 0001 1800 0001 2345" }
3677
+
3523
3678
  it { is_expected.to be_valid }
3524
3679
  end
3525
3680
 
3526
3681
  context "for an invalid Spanish IBAN" do
3527
3682
  let(:iban_code) { "ES90 2310 0001 1800 0001 2345" }
3683
+
3528
3684
  it { is_expected.to_not be_valid }
3529
3685
  end
3530
3686
 
3531
3687
  context "for a valid Swedish IBAN" do
3532
3688
  let(:iban_code) { "SE35 5000 0000 0549 1000 0003" }
3689
+
3533
3690
  it { is_expected.to be_valid }
3534
3691
  end
3535
3692
 
3536
3693
  context "for an invalid Swedish IBAN" do
3537
3694
  let(:iban_code) { "SE95 5000 0000 0549 1000 0003" }
3695
+
3538
3696
  it { is_expected.to_not be_valid }
3539
3697
  end
3540
3698
 
3541
3699
  context "for a valid Swiss IBAN" do
3542
3700
  let(:iban_code) { "CH93 0076 2011 6238 5295 7" }
3701
+
3543
3702
  it { is_expected.to be_valid }
3544
3703
  end
3545
3704
 
3546
3705
  context "for an invalid Swiss IBAN" do
3547
3706
  let(:iban_code) { "CH23 0076 2011 6238 5295 7" }
3707
+
3548
3708
  it { is_expected.to_not be_valid }
3549
3709
  end
3550
3710
 
3551
3711
  context "for a valid Tunisian IBAN" do
3552
3712
  let(:iban_code) { "TN59 1000 6035 1835 9847 8831" }
3713
+
3553
3714
  it { is_expected.to be_valid }
3554
3715
  end
3555
3716
 
3556
3717
  context "for an invalid Tunisian IBAN" do
3557
3718
  let(:iban_code) { "TN99 1000 6035 1835 9847 8831" }
3719
+
3558
3720
  it { is_expected.to_not be_valid }
3559
3721
  end
3560
3722
 
3561
3723
  context "for a valid Turkish IBAN" do
3562
3724
  let(:iban_code) { "TR33 0006 1005 1978 6457 8413 26" }
3725
+
3563
3726
  it { is_expected.to be_valid }
3564
3727
  end
3565
3728
 
3566
3729
  context "for an invalid Turkish IBAN" do
3567
3730
  let(:iban_code) { "TR93 0006 1005 1978 6457 8413 26" }
3731
+
3568
3732
  it { is_expected.to_not be_valid }
3569
3733
  end
3570
3734
 
3571
3735
  context "for a valid UAE IBAN" do
3572
3736
  let(:iban_code) { "AE07 0331 2345 6789 0123 456" }
3737
+
3573
3738
  it { is_expected.to be_valid }
3574
3739
  end
3575
3740
 
3576
3741
  context "for an invalid UAE IBAN" do
3577
3742
  let(:iban_code) { "AE97 0331 2345 6789 0123 456" }
3743
+
3578
3744
  it { is_expected.to_not be_valid }
3579
3745
  end
3580
3746
 
3581
3747
  context "for a valid UK IBAN" do
3582
3748
  let(:iban_code) { "GB82 WEST 1234 5698 7654 32" }
3749
+
3583
3750
  it { is_expected.to be_valid }
3584
3751
  end
3585
3752
 
3586
3753
  context "for an invalid UK IBAN" do
3587
3754
  let(:iban_code) { "GB92 WEST 1234 5698 7654 32" }
3755
+
3588
3756
  it { is_expected.to_not be_valid }
3589
3757
  end
3590
3758
  end
@@ -3592,61 +3760,73 @@ describe Ibandit::IBAN do
3592
3760
  describe "#local_check_digits" do
3593
3761
  context "with a Belgian IBAN" do
3594
3762
  let(:iban_code) { "BE62510007547061" }
3763
+
3595
3764
  its(:local_check_digits) { is_expected.to eq("61") }
3596
3765
  end
3597
3766
 
3598
3767
  context "with a French IBAN" do
3599
3768
  let(:iban_code) { "FR1234567890123456789012345" }
3769
+
3600
3770
  its(:local_check_digits) { is_expected.to eq("45") }
3601
3771
  end
3602
3772
 
3603
3773
  context "with a Monocan IBAN" do
3604
3774
  let(:iban_code) { "MC9320052222100112233M44555" }
3775
+
3605
3776
  its(:local_check_digits) { is_expected.to eq("55") }
3606
3777
  end
3607
3778
 
3608
3779
  context "with a Spanish IBAN" do
3609
3780
  let(:iban_code) { "ES1212345678911234567890" }
3781
+
3610
3782
  its(:local_check_digits) { is_expected.to eq("91") }
3611
3783
  end
3612
3784
 
3613
3785
  context "with an Italian IBAN" do
3614
3786
  let(:iban_code) { "IT12A1234567890123456789012" }
3787
+
3615
3788
  its(:local_check_digits) { is_expected.to eq("A") }
3616
3789
  end
3617
3790
 
3618
3791
  context "with an Estonian IBAN" do
3619
3792
  let(:iban_code) { "EE382200221020145685" }
3793
+
3620
3794
  its(:local_check_digits) { is_expected.to eq("5") }
3621
3795
  end
3622
3796
 
3623
3797
  context "with an Finnish IBAN" do
3624
3798
  let(:iban_code) { "FI2112345600000785" }
3799
+
3625
3800
  its(:local_check_digits) { is_expected.to eq("5") }
3626
3801
  end
3627
3802
 
3628
3803
  context "with an Portuguese IBAN" do
3629
3804
  let(:iban_code) { "PT50000201231234567890154" }
3805
+
3630
3806
  its(:local_check_digits) { is_expected.to eq("54") }
3631
3807
  end
3632
3808
 
3633
3809
  context "with a Norwegian IBAN" do
3634
3810
  let(:iban_code) { "NO9386011117947" }
3811
+
3635
3812
  its(:local_check_digits) { is_expected.to eq("7") }
3636
3813
  end
3637
3814
 
3638
3815
  context "with an Icelandic IBAN" do
3639
3816
  let(:iban_code) { "IS250311260024684606972049" }
3817
+
3640
3818
  its(:local_check_digits) { is_expected.to eq("4") }
3641
3819
  end
3642
3820
 
3643
3821
  context "with a Slovakian IBAN" do
3644
3822
  let(:iban_code) { "SK3112000000198742637541" }
3823
+
3645
3824
  its(:local_check_digits) { is_expected.to eq("9") }
3646
3825
  end
3647
3826
 
3648
3827
  context "with a Dutch IBAN" do
3649
3828
  let(:iban_code) { "NL91ABNA0417164300" }
3829
+
3650
3830
  its(:local_check_digits) { is_expected.to eq("0") }
3651
3831
  end
3652
3832
  end