ibandit 0.11.19 → 0.11.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -4
- data/.rubocop_todo.yml +60 -13
- data/.travis.yml +1 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +0 -6
- data/README.md +18 -0
- data/ibandit.gemspec +2 -2
- data/lib/ibandit.rb +3 -3
- data/lib/ibandit/german_details_converter.rb +3 -3
- data/lib/ibandit/local_details_cleaner.rb +3 -1
- data/lib/ibandit/sweden/bank_lookup.rb +1 -1
- data/lib/ibandit/version.rb +1 -1
- data/spec/ibandit/german_details_converter_spec.rb +9 -5
- data/spec/ibandit/iban_assembler_spec.rb +87 -0
- data/spec/ibandit/iban_spec.rb +186 -35
- data/spec/ibandit/iban_splitter_spec.rb +4 -0
- data/spec/ibandit/local_details_cleaner_spec.rb +140 -0
- data/spec/ibandit/structure_spec.rb +1 -1
- data/spec/ibandit/sweden/validator_spec.rb +33 -0
- metadata +37 -37
data/spec/ibandit/iban_spec.rb
CHANGED
@@ -2,6 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe Ibandit::IBAN do
|
4
4
|
subject(:iban) { described_class.new(arg) }
|
5
|
+
|
5
6
|
let(:arg) { iban_code }
|
6
7
|
let(:iban_code) { "GB82WEST12345698765432" }
|
7
8
|
|
@@ -9,16 +10,19 @@ describe Ibandit::IBAN do
|
|
9
10
|
|
10
11
|
context "with a poorly formatted IBAN" do
|
11
12
|
let(:iban_code) { " gb82 WeSt 1234 5698 7654 32\n" }
|
13
|
+
|
12
14
|
its(:iban) { is_expected.to eq("GB82WEST12345698765432") }
|
13
15
|
end
|
14
16
|
|
15
17
|
context "with nil" do
|
16
18
|
let(:arg) { nil }
|
19
|
+
|
17
20
|
specify { expect { iban }.to raise_error(TypeError) }
|
18
21
|
end
|
19
22
|
|
20
23
|
context "with an invalid pseudo IBAN" do
|
21
24
|
let(:arg) { "dezzzz" }
|
25
|
+
|
22
26
|
its(:iban) { is_expected.to eq("DEZZZZ") }
|
23
27
|
end
|
24
28
|
|
@@ -93,6 +97,7 @@ describe Ibandit::IBAN do
|
|
93
97
|
|
94
98
|
context "when the IBAN was created from a Slovenian IBAN" do
|
95
99
|
let(:iban_code) { "SI56 1910 0000 0123 438" }
|
100
|
+
|
96
101
|
its(:country_code) { is_expected.to eq("SI") }
|
97
102
|
its(:bank_code) { is_expected.to eq("19100") }
|
98
103
|
its(:branch_code) { is_expected.to be_nil }
|
@@ -374,20 +379,14 @@ describe Ibandit::IBAN do
|
|
374
379
|
its(:country_code) { is_expected.to eq("CA") }
|
375
380
|
its(:bank_code) { is_expected.to eq("0036") }
|
376
381
|
its(:branch_code) { is_expected.to eq("00063") }
|
377
|
-
its(:account_number) { is_expected.to eq("
|
382
|
+
its(:account_number) { is_expected.to eq("000000123456") }
|
378
383
|
its(:swift_bank_code) { is_expected.to eq("0036") }
|
379
384
|
its(:swift_branch_code) { is_expected.to eq("00063") }
|
380
|
-
its(:swift_account_number) { is_expected.to eq("
|
381
|
-
its(:pseudo_iban) { is_expected.to eq("
|
382
|
-
|
383
|
-
# ibandit account number length validation can check for maximum
|
384
|
-
# length but not against a range, say, 7 to 12 digits, allowed in CA.
|
385
|
-
#
|
386
|
-
# given we are only going to deal with pseudo-IBANs in CA, choosing to
|
387
|
-
# not complete IBAN validation unless we need it.
|
388
|
-
#
|
385
|
+
its(:swift_account_number) { is_expected.to eq("000000123456") }
|
386
|
+
its(:pseudo_iban) { is_expected.to eq("CAZZ003600063000000123456") }
|
387
|
+
|
389
388
|
its(:iban) { is_expected.to be_nil }
|
390
|
-
its(:valid?) { is_expected.to eq(
|
389
|
+
its(:valid?) { is_expected.to eq(true) }
|
391
390
|
its(:to_s) { is_expected.to eq("") }
|
392
391
|
end
|
393
392
|
|
@@ -403,14 +402,8 @@ describe Ibandit::IBAN do
|
|
403
402
|
its(:swift_account_number) { is_expected.to eq("012345678900") }
|
404
403
|
its(:pseudo_iban) { is_expected.to eq("CAZZ003600063012345678900") }
|
405
404
|
|
406
|
-
# ibandit account number length validation can check for maximum
|
407
|
-
# length but not against a range, say, 7 to 12 digits, allowed in CA.
|
408
|
-
#
|
409
|
-
# given we are only going to deal with pseudo-IBANs in CA, choosing to
|
410
|
-
# not complete IBAN validation unless we need it.
|
411
|
-
#
|
412
405
|
its(:iban) { is_expected.to be_nil }
|
413
|
-
its(:valid?) { is_expected.to
|
406
|
+
its(:valid?) { is_expected.to be true }
|
414
407
|
its(:to_s) { is_expected.to eq("") }
|
415
408
|
end
|
416
409
|
end
|
@@ -421,24 +414,18 @@ describe Ibandit::IBAN do
|
|
421
414
|
its(:country_code) { is_expected.to eq("CA") }
|
422
415
|
its(:bank_code) { is_expected.to eq("0036") }
|
423
416
|
its(:branch_code) { is_expected.to eq("00063") }
|
424
|
-
its(:account_number) { is_expected.to eq("
|
417
|
+
its(:account_number) { is_expected.to eq("000000123456") }
|
425
418
|
its(:swift_bank_code) { is_expected.to eq("0036") }
|
426
419
|
its(:swift_branch_code) { is_expected.to eq("00063") }
|
427
|
-
its(:swift_account_number) { is_expected.to eq("
|
428
|
-
its(:pseudo_iban) { is_expected.to eq("
|
429
|
-
|
430
|
-
# ibandit account number length validation can check for maximum
|
431
|
-
# length but not against a range, say, 7 to 12 digits, allowed in CA.
|
432
|
-
#
|
433
|
-
# given we are only going to deal with pseudo-IBANs in CA, choosing to
|
434
|
-
# not complete IBAN validation unless we need it.
|
435
|
-
#
|
420
|
+
its(:swift_account_number) { is_expected.to eq("000000123456") }
|
421
|
+
its(:pseudo_iban) { is_expected.to eq("CAZZ003600063000000123456") }
|
422
|
+
|
436
423
|
its(:iban) { is_expected.to be_nil }
|
437
|
-
its(:valid?) { is_expected.to
|
424
|
+
its(:valid?) { is_expected.to be true }
|
438
425
|
its(:to_s) { is_expected.to eq("") }
|
439
426
|
end
|
440
427
|
|
441
|
-
context "when the input is an invalid
|
428
|
+
context "when the input is an invalid Canadian pseudo-IBAN" do
|
442
429
|
let(:arg) { "CAZZ00360006301234" }
|
443
430
|
|
444
431
|
it "is invalid and has the correct errors" do
|
@@ -457,6 +444,7 @@ describe Ibandit::IBAN do
|
|
457
444
|
account_number: account_number,
|
458
445
|
}
|
459
446
|
end
|
447
|
+
|
460
448
|
context "with a 3 digit account number suffix" do
|
461
449
|
let(:account_number) { "3333333-944" }
|
462
450
|
|
@@ -474,6 +462,7 @@ describe Ibandit::IBAN do
|
|
474
462
|
its(:valid?) { is_expected.to eq(true) }
|
475
463
|
its(:to_s) { is_expected.to eq("") }
|
476
464
|
end
|
465
|
+
|
477
466
|
context "with a 2 digit account number suffix" do
|
478
467
|
let(:account_number) { "3333333-44" }
|
479
468
|
|
@@ -491,6 +480,7 @@ describe Ibandit::IBAN do
|
|
491
480
|
its(:valid?) { is_expected.to eq(true) }
|
492
481
|
its(:to_s) { is_expected.to eq("") }
|
493
482
|
end
|
483
|
+
|
494
484
|
context "with bank and branch code embedded in account_number field" do
|
495
485
|
let(:arg) do
|
496
486
|
{
|
@@ -513,6 +503,7 @@ describe Ibandit::IBAN do
|
|
513
503
|
its(:valid?) { is_expected.to eq(true) }
|
514
504
|
its(:to_s) { is_expected.to eq("") }
|
515
505
|
end
|
506
|
+
|
516
507
|
context "with a bank code embedded in account_number field" do
|
517
508
|
let(:arg) do
|
518
509
|
{
|
@@ -574,6 +565,7 @@ describe Ibandit::IBAN do
|
|
574
565
|
|
575
566
|
context "with the IBAN is nil" do
|
576
567
|
let(:arg) { { country_code: "GB" } }
|
568
|
+
|
577
569
|
its(:to_s) { is_expected.to_not be_nil }
|
578
570
|
specify { expect(iban.to_s(:formatted)).to be_empty }
|
579
571
|
end
|
@@ -586,11 +578,13 @@ describe Ibandit::IBAN do
|
|
586
578
|
account_number: "0105723",
|
587
579
|
}
|
588
580
|
end
|
581
|
+
|
589
582
|
specify { expect(iban.to_s).to eq("SE5412000000012810105723") }
|
590
583
|
end
|
591
584
|
|
592
585
|
context "with a Swedish pseudo-IBAN" do
|
593
586
|
let(:arg) { "SEZZX1281XXX0105723" }
|
587
|
+
|
594
588
|
specify { expect(iban.to_s).to eq("SE5412000000012810105723") }
|
595
589
|
end
|
596
590
|
end
|
@@ -608,7 +602,9 @@ describe Ibandit::IBAN do
|
|
608
602
|
|
609
603
|
context "with an unknown country code" do
|
610
604
|
before { iban.valid_country_code? }
|
605
|
+
|
611
606
|
let(:iban_code) { "AA123456789123456" }
|
607
|
+
|
612
608
|
it { is_expected.to eq(false) }
|
613
609
|
|
614
610
|
context "locale en", locale: :en do
|
@@ -655,16 +651,19 @@ describe Ibandit::IBAN do
|
|
655
651
|
|
656
652
|
context "with valid details" do
|
657
653
|
let(:iban_code) { "GB82WEST12345698765432" }
|
654
|
+
|
658
655
|
it { is_expected.to eq(true) }
|
659
656
|
|
660
657
|
context "where the check digit is zero-padded" do
|
661
658
|
let(:iban_code) { "GB06WEST12345698765442" }
|
659
|
+
|
662
660
|
it { is_expected.to eq(true) }
|
663
661
|
end
|
664
662
|
end
|
665
663
|
|
666
664
|
context "with invalid details" do
|
667
665
|
let(:iban_code) { "GB12WEST12345698765432" }
|
666
|
+
|
668
667
|
it { is_expected.to eq(false) }
|
669
668
|
|
670
669
|
context "locale en", locale: :en do
|
@@ -778,6 +777,7 @@ describe Ibandit::IBAN do
|
|
778
777
|
|
779
778
|
context "with invalid characters" do
|
780
779
|
let(:iban_code) { "AA82-EST123456987654" }
|
780
|
+
|
781
781
|
it { is_expected.to be_nil }
|
782
782
|
|
783
783
|
it "does not set errors on the IBAN" do
|
@@ -788,6 +788,7 @@ describe Ibandit::IBAN do
|
|
788
788
|
|
789
789
|
context "with an empty IBAN" do
|
790
790
|
let(:iban_code) { "" }
|
791
|
+
|
791
792
|
it { is_expected.to be_nil }
|
792
793
|
|
793
794
|
it "does not set errors on the IBAN" do
|
@@ -806,6 +807,7 @@ describe Ibandit::IBAN do
|
|
806
807
|
|
807
808
|
context "with invalid details" do
|
808
809
|
let(:iban_code) { "GB82WEST123456987654" }
|
810
|
+
|
809
811
|
it { is_expected.to eq(false) }
|
810
812
|
|
811
813
|
context "locale en", locale: :en do
|
@@ -918,6 +920,7 @@ describe Ibandit::IBAN do
|
|
918
920
|
|
919
921
|
context "with an invalid country_code" do
|
920
922
|
let(:iban_code) { "AA82WEST123456987654" }
|
923
|
+
|
921
924
|
it { is_expected.to be_nil }
|
922
925
|
|
923
926
|
it "does not set errors on the IBAN" do
|
@@ -936,6 +939,7 @@ describe Ibandit::IBAN do
|
|
936
939
|
|
937
940
|
context "with invalid details" do
|
938
941
|
before { allow(iban).to receive(:swift_bank_code).and_return("WES") }
|
942
|
+
|
939
943
|
it { is_expected.to eq(false) }
|
940
944
|
|
941
945
|
context "locale en", locale: :en do
|
@@ -1036,6 +1040,7 @@ describe Ibandit::IBAN do
|
|
1036
1040
|
|
1037
1041
|
context "with an invalid country_code" do
|
1038
1042
|
before { allow(iban).to receive(:country_code).and_return("AA") }
|
1043
|
+
|
1039
1044
|
it { is_expected.to be_nil }
|
1040
1045
|
|
1041
1046
|
it "does not set errors on the IBAN" do
|
@@ -1054,6 +1059,7 @@ describe Ibandit::IBAN do
|
|
1054
1059
|
|
1055
1060
|
context "with invalid details" do
|
1056
1061
|
before { allow(iban).to receive(:swift_branch_code).and_return("12345") }
|
1062
|
+
|
1057
1063
|
it { is_expected.to eq(false) }
|
1058
1064
|
|
1059
1065
|
context "locale en", locale: :en do
|
@@ -1154,6 +1160,7 @@ describe Ibandit::IBAN do
|
|
1154
1160
|
|
1155
1161
|
context "without a branch code" do
|
1156
1162
|
before { allow(iban).to receive(:swift_branch_code).and_return(nil) }
|
1163
|
+
|
1157
1164
|
it { is_expected.to eq(false) }
|
1158
1165
|
|
1159
1166
|
context "locale en", locale: :en do
|
@@ -1236,6 +1243,7 @@ describe Ibandit::IBAN do
|
|
1236
1243
|
|
1237
1244
|
context "with an invalid country_code" do
|
1238
1245
|
before { allow(iban).to receive(:country_code).and_return("AA") }
|
1246
|
+
|
1239
1247
|
it { is_expected.to be_nil }
|
1240
1248
|
|
1241
1249
|
it "does not set errors on the IBAN" do
|
@@ -1256,6 +1264,7 @@ describe Ibandit::IBAN do
|
|
1256
1264
|
before do
|
1257
1265
|
allow(iban).to receive(:swift_account_number).and_return("1234567")
|
1258
1266
|
end
|
1267
|
+
|
1259
1268
|
it { is_expected.to eq(false) }
|
1260
1269
|
|
1261
1270
|
context "locale en", locale: :en do
|
@@ -1358,6 +1367,7 @@ describe Ibandit::IBAN do
|
|
1358
1367
|
|
1359
1368
|
context "with an invalid country_code" do
|
1360
1369
|
before { allow(iban).to receive(:country_code).and_return("AA") }
|
1370
|
+
|
1361
1371
|
it { is_expected.to be_nil }
|
1362
1372
|
|
1363
1373
|
it "does not set errors on the IBAN" do
|
@@ -1372,11 +1382,13 @@ describe Ibandit::IBAN do
|
|
1372
1382
|
|
1373
1383
|
context "with valid details" do
|
1374
1384
|
let(:iban_code) { "GB82WEST12345698765432" }
|
1385
|
+
|
1375
1386
|
it { is_expected.to eq(true) }
|
1376
1387
|
end
|
1377
1388
|
|
1378
1389
|
context "with invalid details" do
|
1379
1390
|
let(:iban_code) { "GB-123ABCD" }
|
1391
|
+
|
1380
1392
|
it { is_expected.to eq(false) }
|
1381
1393
|
|
1382
1394
|
context "locale en", locale: :en do
|
@@ -1476,11 +1488,13 @@ describe Ibandit::IBAN do
|
|
1476
1488
|
|
1477
1489
|
context "with valid details" do
|
1478
1490
|
let(:iban_code) { "GB82WEST12345698765432" }
|
1491
|
+
|
1479
1492
|
it { is_expected.to eq(true) }
|
1480
1493
|
end
|
1481
1494
|
|
1482
1495
|
context "with invalid details" do
|
1483
1496
|
let(:iban_code) { "GB82WEST12AAAAAA7654" }
|
1497
|
+
|
1484
1498
|
it { is_expected.to eq(false) }
|
1485
1499
|
|
1486
1500
|
context "locale en", locale: :en do
|
@@ -1574,6 +1588,7 @@ describe Ibandit::IBAN do
|
|
1574
1588
|
|
1575
1589
|
context "with an invalid country_code" do
|
1576
1590
|
let(:iban_code) { "AA82WEST12AAAAAA7654" }
|
1591
|
+
|
1577
1592
|
it { is_expected.to be_nil }
|
1578
1593
|
|
1579
1594
|
it "does not set errors on the IBAN" do
|
@@ -1935,7 +1950,9 @@ describe Ibandit::IBAN do
|
|
1935
1950
|
valid_account_number?: valid_account_number,
|
1936
1951
|
)
|
1937
1952
|
end
|
1953
|
+
|
1938
1954
|
after { Ibandit.modulus_checker = nil }
|
1955
|
+
|
1939
1956
|
before { iban.valid_local_modulus_check? }
|
1940
1957
|
|
1941
1958
|
context "with an invalid bank code" do
|
@@ -1947,7 +1964,7 @@ describe Ibandit::IBAN do
|
|
1947
1964
|
it "calls valid_bank_code? with an IBAN object" do
|
1948
1965
|
expect(Ibandit.modulus_checker).
|
1949
1966
|
to receive(:valid_bank_code?).
|
1950
|
-
with(instance_of(
|
1967
|
+
with(instance_of(described_class))
|
1951
1968
|
|
1952
1969
|
iban.valid_local_modulus_check?
|
1953
1970
|
end
|
@@ -2008,8 +2025,11 @@ describe Ibandit::IBAN do
|
|
2008
2025
|
context "with an invalid branch code" do
|
2009
2026
|
let(:iban_code) { "GB60BARC20000055779911" }
|
2010
2027
|
before { Ibandit.bic_finder = double(call: "BARCGB22XXX") }
|
2028
|
+
|
2011
2029
|
after { Ibandit.bic_finder = nil }
|
2030
|
+
|
2012
2031
|
before { iban.valid_local_modulus_check? }
|
2032
|
+
|
2013
2033
|
let(:valid_bank_code) { true }
|
2014
2034
|
let(:valid_branch_code) { false }
|
2015
2035
|
let(:valid_account_number) { true }
|
@@ -2017,7 +2037,7 @@ describe Ibandit::IBAN do
|
|
2017
2037
|
it "calls valid_branch_code? with an IBAN object" do
|
2018
2038
|
expect(Ibandit.modulus_checker).
|
2019
2039
|
to receive(:valid_branch_code?).
|
2020
|
-
with(instance_of(
|
2040
|
+
with(instance_of(described_class))
|
2021
2041
|
|
2022
2042
|
iban.valid_local_modulus_check?
|
2023
2043
|
end
|
@@ -2099,7 +2119,7 @@ describe Ibandit::IBAN do
|
|
2099
2119
|
it "calls valid_account_number? with an IBAN object" do
|
2100
2120
|
expect(Ibandit.modulus_checker).
|
2101
2121
|
to receive(:valid_account_number?).
|
2102
|
-
with(instance_of(
|
2122
|
+
with(instance_of(described_class))
|
2103
2123
|
|
2104
2124
|
iban.valid_local_modulus_check?
|
2105
2125
|
end
|
@@ -2430,6 +2450,7 @@ describe Ibandit::IBAN do
|
|
2430
2450
|
)
|
2431
2451
|
iban.valid_australian_details?
|
2432
2452
|
end
|
2453
|
+
|
2433
2454
|
after { Ibandit.modulus_checker = nil }
|
2434
2455
|
|
2435
2456
|
let(:valid_branch_code) { true }
|
@@ -2437,7 +2458,7 @@ describe Ibandit::IBAN do
|
|
2437
2458
|
it "calls valid_branch_code? with an IBAN object" do
|
2438
2459
|
expect(Ibandit.modulus_checker).
|
2439
2460
|
to receive(:valid_branch_code?).
|
2440
|
-
with(instance_of(
|
2461
|
+
with(instance_of(described_class))
|
2441
2462
|
|
2442
2463
|
iban.valid_australian_details?
|
2443
2464
|
end
|
@@ -2556,6 +2577,7 @@ describe Ibandit::IBAN do
|
|
2556
2577
|
)
|
2557
2578
|
iban.valid_nz_details?
|
2558
2579
|
end
|
2580
|
+
|
2559
2581
|
after { Ibandit.modulus_checker = nil }
|
2560
2582
|
|
2561
2583
|
let(:valid_branch_code) { true }
|
@@ -2563,7 +2585,7 @@ describe Ibandit::IBAN do
|
|
2563
2585
|
it "calls valid_branch_code? with an IBAN object" do
|
2564
2586
|
expect(Ibandit.modulus_checker).
|
2565
2587
|
to receive(:valid_branch_code?).
|
2566
|
-
with(instance_of(
|
2588
|
+
with(instance_of(described_class))
|
2567
2589
|
|
2568
2590
|
iban.valid_nz_details?
|
2569
2591
|
end
|
@@ -2684,586 +2706,703 @@ describe Ibandit::IBAN do
|
|
2684
2706
|
|
2685
2707
|
context "for a valid Albanian IBAN" do
|
2686
2708
|
let(:iban_code) { "AL47 2121 1009 0000 0002 3569 8741" }
|
2709
|
+
|
2687
2710
|
it { is_expected.to be_valid }
|
2688
2711
|
end
|
2689
2712
|
|
2690
2713
|
context "for a valid Andorran IBAN" do
|
2691
2714
|
let(:iban_code) { "AD12 0001 2030 2003 5910 0100" }
|
2715
|
+
|
2692
2716
|
it { is_expected.to be_valid }
|
2693
2717
|
end
|
2694
2718
|
|
2695
2719
|
context "for a valid Austrian IBAN" do
|
2696
2720
|
let(:iban_code) { "AT61 1904 3002 3457 3201" }
|
2721
|
+
|
2697
2722
|
it { is_expected.to be_valid }
|
2698
2723
|
end
|
2699
2724
|
|
2700
2725
|
context "for a valid Australian pseudo-IBAN" do
|
2701
2726
|
let(:iban_code) { "AUZZ123456123456789" }
|
2727
|
+
|
2702
2728
|
it { is_expected.to be_valid }
|
2703
2729
|
end
|
2704
2730
|
|
2705
2731
|
context "for an invalid Australian pseudo-IBAN" do
|
2706
2732
|
let(:iban_code) { "AU99123456123456789" }
|
2733
|
+
|
2707
2734
|
it { is_expected.to_not be_valid }
|
2708
2735
|
end
|
2709
2736
|
|
2710
2737
|
context "for a valid Azerbaijanian IBAN" do
|
2711
2738
|
let(:iban_code) { "AZ21 NABZ 0000 0000 1370 1000 1944" }
|
2739
|
+
|
2712
2740
|
it { is_expected.to be_valid }
|
2713
2741
|
end
|
2714
2742
|
|
2715
2743
|
context "for an invalid Azerbaijanian IBAN" do
|
2716
2744
|
let(:iban_code) { "AZ91 NABZ 0000 0000 1370 1000 1944" }
|
2745
|
+
|
2717
2746
|
it { is_expected.to_not be_valid }
|
2718
2747
|
end
|
2719
2748
|
|
2720
2749
|
context "for a valid Bahrainian IBAN" do
|
2721
2750
|
let(:iban_code) { "BH67 BMAG 0000 1299 1234 56" }
|
2751
|
+
|
2722
2752
|
it { is_expected.to be_valid }
|
2723
2753
|
end
|
2724
2754
|
|
2725
2755
|
context "for an invalid Bahrainian IBAN" do
|
2726
2756
|
let(:iban_code) { "BH97 BMAG 0000 1299 1234 56" }
|
2757
|
+
|
2727
2758
|
it { is_expected.to_not be_valid }
|
2728
2759
|
end
|
2729
2760
|
|
2730
2761
|
context "for a valid Belgian IBAN" do
|
2731
2762
|
let(:iban_code) { "BE62 5100 0754 7061" }
|
2763
|
+
|
2732
2764
|
it { is_expected.to be_valid }
|
2733
2765
|
end
|
2734
2766
|
|
2735
2767
|
context "for an invalid Belgian IBAN" do
|
2736
2768
|
let(:iban_code) { "BE92 5100 0754 7061" }
|
2769
|
+
|
2737
2770
|
it { is_expected.to_not be_valid }
|
2738
2771
|
end
|
2739
2772
|
|
2740
2773
|
context "for a valid Bosnian IBAN" do
|
2741
2774
|
let(:iban_code) { "BA39 1290 0794 0102 8494" }
|
2775
|
+
|
2742
2776
|
it { is_expected.to be_valid }
|
2743
2777
|
end
|
2744
2778
|
|
2745
2779
|
context "for an invalid Bosnian IBAN" do
|
2746
2780
|
let(:iban_code) { "BA99 1290 0794 0102 8494" }
|
2781
|
+
|
2747
2782
|
it { is_expected.to_not be_valid }
|
2748
2783
|
end
|
2749
2784
|
|
2750
2785
|
context "for a valid Bulgarian IBAN" do
|
2751
2786
|
let(:iban_code) { "BG80 BNBG 9661 1020 3456 78" }
|
2787
|
+
|
2752
2788
|
it { is_expected.to be_valid }
|
2753
2789
|
end
|
2754
2790
|
|
2755
2791
|
context "for an invalid Bulgarian IBAN" do
|
2756
2792
|
let(:iban_code) { "BG90 BNBG 9661 1020 3456 78" }
|
2793
|
+
|
2757
2794
|
it { is_expected.to_not be_valid }
|
2758
2795
|
end
|
2759
2796
|
|
2760
2797
|
context "for a valid Croatian IBAN" do
|
2761
2798
|
let(:iban_code) { "HR12 1001 0051 8630 0016 0" }
|
2799
|
+
|
2762
2800
|
it { is_expected.to be_valid }
|
2763
2801
|
end
|
2764
2802
|
|
2765
2803
|
context "for an invalid Croatian IBAN" do
|
2766
2804
|
let(:iban_code) { "HR92 1001 0051 8630 0016 0" }
|
2805
|
+
|
2767
2806
|
it { is_expected.to_not be_valid }
|
2768
2807
|
end
|
2769
2808
|
|
2770
2809
|
context "for a valid Cypriot IBAN" do
|
2771
2810
|
let(:iban_code) { "CY17 0020 0128 0000 0012 0052 7600" }
|
2811
|
+
|
2772
2812
|
it { is_expected.to be_valid }
|
2773
2813
|
end
|
2774
2814
|
|
2775
2815
|
context "for an invalid Cypriot IBAN" do
|
2776
2816
|
let(:iban_code) { "CY97 0020 0128 0000 0012 0052 7600" }
|
2817
|
+
|
2777
2818
|
it { is_expected.to_not be_valid }
|
2778
2819
|
end
|
2779
2820
|
|
2780
2821
|
context "for a valid Czech IBAN" do
|
2781
2822
|
let(:iban_code) { "CZ65 0800 0000 1920 0014 5399" }
|
2823
|
+
|
2782
2824
|
it { is_expected.to be_valid }
|
2783
2825
|
end
|
2784
2826
|
|
2785
2827
|
context "for an invalid Czech IBAN" do
|
2786
2828
|
let(:iban_code) { "CZ95 0800 0000 1920 0014 5399" }
|
2829
|
+
|
2787
2830
|
it { is_expected.to_not be_valid }
|
2788
2831
|
end
|
2789
2832
|
|
2790
2833
|
context "for a valid Danish IBAN" do
|
2791
2834
|
let(:iban_code) { "DK50 0040 0440 1162 43" }
|
2835
|
+
|
2792
2836
|
it { is_expected.to be_valid }
|
2793
2837
|
end
|
2794
2838
|
|
2795
2839
|
context "for an invalid Danish IBAN" do
|
2796
2840
|
let(:iban_code) { "DK90 0040 0440 1162 43" }
|
2841
|
+
|
2797
2842
|
it { is_expected.to_not be_valid }
|
2798
2843
|
end
|
2799
2844
|
|
2800
2845
|
context "for a valid Estonian IBAN" do
|
2801
2846
|
let(:iban_code) { "EE38 2200 2210 2014 5685" }
|
2847
|
+
|
2802
2848
|
it { is_expected.to be_valid }
|
2803
2849
|
end
|
2804
2850
|
|
2805
2851
|
context "for an invalid Estonian IBAN" do
|
2806
2852
|
let(:iban_code) { "EE98 2200 2210 2014 5685" }
|
2853
|
+
|
2807
2854
|
it { is_expected.to_not be_valid }
|
2808
2855
|
end
|
2809
2856
|
|
2810
2857
|
context "for a valid Faroe Islands IBAN" do
|
2811
2858
|
let(:iban_code) { "FO97 5432 0388 8999 44" }
|
2859
|
+
|
2812
2860
|
it { is_expected.to be_valid }
|
2813
2861
|
end
|
2814
2862
|
|
2815
2863
|
context "for an invalid Faroe Islands IBAN" do
|
2816
2864
|
let(:iban_code) { "FO27 5432 0388 8999 44" }
|
2865
|
+
|
2817
2866
|
it { is_expected.to_not be_valid }
|
2818
2867
|
end
|
2819
2868
|
|
2820
2869
|
context "for a valid Finnish IBAN" do
|
2821
2870
|
let(:iban_code) { "FI21 1234 5600 0007 85" }
|
2871
|
+
|
2822
2872
|
it { is_expected.to be_valid }
|
2823
2873
|
end
|
2824
2874
|
|
2825
2875
|
context "for an invalid Finnish IBAN" do
|
2826
2876
|
let(:iban_code) { "FI91 1234 5600 0007 85" }
|
2877
|
+
|
2827
2878
|
it { is_expected.to_not be_valid }
|
2828
2879
|
end
|
2829
2880
|
|
2830
2881
|
context "for a valid French IBAN" do
|
2831
2882
|
let(:iban_code) { "FR14 2004 1010 0505 0001 3M02 606" }
|
2883
|
+
|
2832
2884
|
it { is_expected.to be_valid }
|
2833
2885
|
end
|
2834
2886
|
|
2835
2887
|
context "for an invalid French IBAN" do
|
2836
2888
|
let(:iban_code) { "FR94 2004 1010 0505 0001 3M02 606" }
|
2889
|
+
|
2837
2890
|
it { is_expected.to_not be_valid }
|
2838
2891
|
end
|
2839
2892
|
|
2840
2893
|
context "for a valid Georgian IBAN" do
|
2841
2894
|
let(:iban_code) { "GE29 NB00 0000 0101 9049 17" }
|
2895
|
+
|
2842
2896
|
it { is_expected.to be_valid }
|
2843
2897
|
end
|
2844
2898
|
|
2845
2899
|
context "for an invalid Georgian IBAN" do
|
2846
2900
|
let(:iban_code) { "GE99 NB00 0000 0101 9049 17" }
|
2901
|
+
|
2847
2902
|
it { is_expected.to_not be_valid }
|
2848
2903
|
end
|
2849
2904
|
|
2850
2905
|
context "for a valid German IBAN" do
|
2851
2906
|
let(:iban_code) { "DE89 3704 0044 0532 0130 00" }
|
2907
|
+
|
2852
2908
|
it { is_expected.to be_valid }
|
2853
2909
|
end
|
2854
2910
|
|
2855
2911
|
context "for an invalid German IBAN" do
|
2856
2912
|
let(:iban_code) { "DE99 3704 0044 0532 0130 00" }
|
2913
|
+
|
2857
2914
|
it { is_expected.to_not be_valid }
|
2858
2915
|
end
|
2859
2916
|
|
2860
2917
|
context "for a valid Gibraltan IBAN" do
|
2861
2918
|
let(:iban_code) { "GI75 NWBK 0000 0000 7099 453" }
|
2919
|
+
|
2862
2920
|
it { is_expected.to be_valid }
|
2863
2921
|
end
|
2864
2922
|
|
2865
2923
|
context "for an invalid Gibraltan IBAN" do
|
2866
2924
|
let(:iban_code) { "GI95 NWBK 0000 0000 7099 453" }
|
2925
|
+
|
2867
2926
|
it { is_expected.to_not be_valid }
|
2868
2927
|
end
|
2869
2928
|
|
2870
2929
|
context "for a valid Greek IBAN" do
|
2871
2930
|
let(:iban_code) { "GR16 0110 1250 0000 0001 2300 695" }
|
2931
|
+
|
2872
2932
|
it { is_expected.to be_valid }
|
2873
2933
|
end
|
2874
2934
|
|
2875
2935
|
context "for an invalid Greek IBAN" do
|
2876
2936
|
let(:iban_code) { "GR96 0110 1250 0000 0001 2300 695" }
|
2937
|
+
|
2877
2938
|
it { is_expected.to_not be_valid }
|
2878
2939
|
end
|
2879
2940
|
|
2880
2941
|
context "for a valid Greenland IBAN" do
|
2881
2942
|
let(:iban_code) { "GL56 0444 9876 5432 10" }
|
2943
|
+
|
2882
2944
|
it { is_expected.to be_valid }
|
2883
2945
|
end
|
2884
2946
|
|
2885
2947
|
context "for an invalid Greenland IBAN" do
|
2886
2948
|
let(:iban_code) { "GL96 0444 9876 5432 10" }
|
2949
|
+
|
2887
2950
|
it { is_expected.to_not be_valid }
|
2888
2951
|
end
|
2889
2952
|
|
2890
2953
|
context "for a valid Hungarian IBAN" do
|
2891
2954
|
let(:iban_code) { "HU42 1177 3016 1111 1018 0000 0000" }
|
2955
|
+
|
2892
2956
|
it { is_expected.to be_valid }
|
2893
2957
|
end
|
2894
2958
|
|
2895
2959
|
context "for an invalid Hungarian IBAN" do
|
2896
2960
|
let(:iban_code) { "HU92 1177 3016 1111 1018 0000 0000" }
|
2961
|
+
|
2897
2962
|
it { is_expected.to_not be_valid }
|
2898
2963
|
end
|
2899
2964
|
|
2900
2965
|
context "for a valid Icelandic IBAN" do
|
2901
2966
|
let(:iban_code) { "IS14 0159 2600 7654 5510 7303 39" }
|
2967
|
+
|
2902
2968
|
it { is_expected.to be_valid }
|
2903
2969
|
end
|
2904
2970
|
|
2905
2971
|
context "for an invalid Icelandic IBAN" do
|
2906
2972
|
let(:iban_code) { "IS94 0159 2600 7654 5510 7303 39" }
|
2973
|
+
|
2907
2974
|
it { is_expected.to_not be_valid }
|
2908
2975
|
end
|
2909
2976
|
|
2910
2977
|
context "for a valid Irish IBAN" do
|
2911
2978
|
let(:iban_code) { "IE29 AIBK 9311 5212 3456 78" }
|
2979
|
+
|
2912
2980
|
it { is_expected.to be_valid }
|
2913
2981
|
end
|
2914
2982
|
|
2915
2983
|
context "for an invalid Irish IBAN" do
|
2916
2984
|
let(:iban_code) { "IE99 AIBK 9311 5212 3456 78" }
|
2985
|
+
|
2917
2986
|
it { is_expected.to_not be_valid }
|
2918
2987
|
end
|
2919
2988
|
|
2920
2989
|
context "for a valid Israeli IBAN" do
|
2921
2990
|
let(:iban_code) { "IL62 0108 0000 0009 9999 999" }
|
2991
|
+
|
2922
2992
|
it { is_expected.to be_valid }
|
2923
2993
|
end
|
2924
2994
|
|
2925
2995
|
context "for an invalid Israeli IBAN" do
|
2926
2996
|
let(:iban_code) { "IL92 0108 0000 0009 9999 999" }
|
2997
|
+
|
2927
2998
|
it { is_expected.to_not be_valid }
|
2928
2999
|
end
|
2929
3000
|
|
2930
3001
|
context "for a valid Italian IBAN" do
|
2931
3002
|
let(:iban_code) { "IT40 S054 2811 1010 0000 0123 456" }
|
3003
|
+
|
2932
3004
|
it { is_expected.to be_valid }
|
2933
3005
|
end
|
2934
3006
|
|
2935
3007
|
context "for an invalid Italian IBAN" do
|
2936
3008
|
let(:iban_code) { "IT90 S054 2811 1010 0000 0123 456" }
|
3009
|
+
|
2937
3010
|
it { is_expected.to_not be_valid }
|
2938
3011
|
end
|
2939
3012
|
|
2940
3013
|
context "for a valid Jordanian IBAN" do
|
2941
3014
|
let(:iban_code) { "JO94 CBJO 0010 0000 0000 0131 0003 02" }
|
3015
|
+
|
2942
3016
|
it { is_expected.to be_valid }
|
2943
3017
|
end
|
2944
3018
|
|
2945
3019
|
context "for an invalid Jordanian IBAN" do
|
2946
3020
|
let(:iban_code) { "JO24 CBJO 0010 0000 0000 0131 0003 02" }
|
3021
|
+
|
2947
3022
|
it { is_expected.to_not be_valid }
|
2948
3023
|
end
|
2949
3024
|
|
2950
3025
|
context "for a valid Kuwaiti IBAN" do
|
2951
3026
|
let(:iban_code) { "KW81 CBKU 0000 0000 0000 1234 5601 01" }
|
3027
|
+
|
2952
3028
|
it { is_expected.to be_valid }
|
2953
3029
|
end
|
2954
3030
|
|
2955
3031
|
context "for an invalid Kuwaiti IBAN" do
|
2956
3032
|
let(:iban_code) { "KW91 CBKU 0000 0000 0000 1234 5601 01" }
|
3033
|
+
|
2957
3034
|
it { is_expected.to_not be_valid }
|
2958
3035
|
end
|
2959
3036
|
|
2960
3037
|
context "for a valid Latvian IBAN" do
|
2961
3038
|
let(:iban_code) { "LV80 BANK 0000 4351 9500 1" }
|
3039
|
+
|
2962
3040
|
it { is_expected.to be_valid }
|
2963
3041
|
end
|
2964
3042
|
|
2965
3043
|
context "for an invalid Latvian IBAN" do
|
2966
3044
|
let(:iban_code) { "LV90 BANK 0000 4351 9500 1" }
|
3045
|
+
|
2967
3046
|
it { is_expected.to_not be_valid }
|
2968
3047
|
end
|
2969
3048
|
|
2970
3049
|
context "for a valid Lebanese IBAN" do
|
2971
3050
|
let(:iban_code) { "LB62 0999 0000 0001 0019 0122 9114" }
|
3051
|
+
|
2972
3052
|
it { is_expected.to be_valid }
|
2973
3053
|
end
|
2974
3054
|
|
2975
3055
|
context "for an invalid Lebanese IBAN" do
|
2976
3056
|
let(:iban_code) { "LB92 0999 0000 0001 0019 0122 9114" }
|
3057
|
+
|
2977
3058
|
it { is_expected.to_not be_valid }
|
2978
3059
|
end
|
2979
3060
|
|
2980
3061
|
context "for a valid Liechtensteinian IBAN" do
|
2981
3062
|
let(:iban_code) { "LI21 0881 0000 2324 013A A" }
|
3063
|
+
|
2982
3064
|
it { is_expected.to be_valid }
|
2983
3065
|
end
|
2984
3066
|
|
2985
3067
|
context "for an invalid Liechtensteinian IBAN" do
|
2986
3068
|
let(:iban_code) { "LI91 0881 0000 2324 013A A" }
|
3069
|
+
|
2987
3070
|
it { is_expected.to_not be_valid }
|
2988
3071
|
end
|
2989
3072
|
|
2990
3073
|
context "for a valid Lithuanian IBAN" do
|
2991
3074
|
let(:iban_code) { "LT12 1000 0111 0100 1000" }
|
3075
|
+
|
2992
3076
|
it { is_expected.to be_valid }
|
2993
3077
|
end
|
2994
3078
|
|
2995
3079
|
context "for an invalid Lithuanian IBAN" do
|
2996
3080
|
let(:iban_code) { "LT92 1000 0111 0100 1000" }
|
3081
|
+
|
2997
3082
|
it { is_expected.to_not be_valid }
|
2998
3083
|
end
|
2999
3084
|
|
3000
3085
|
context "for a valid Luxembourgian IBAN" do
|
3001
3086
|
let(:iban_code) { "LU28 0019 4006 4475 0000" }
|
3087
|
+
|
3002
3088
|
it { is_expected.to be_valid }
|
3003
3089
|
end
|
3004
3090
|
|
3005
3091
|
context "for an invalid Luxembourgian IBAN" do
|
3006
3092
|
let(:iban_code) { "LU98 0019 4006 4475 0000" }
|
3093
|
+
|
3007
3094
|
it { is_expected.to_not be_valid }
|
3008
3095
|
end
|
3009
3096
|
|
3010
3097
|
context "for a valid Macedonian IBAN" do
|
3011
3098
|
let(:iban_code) { "MK072 5012 0000 0589 84" }
|
3099
|
+
|
3012
3100
|
it { is_expected.to be_valid }
|
3013
3101
|
end
|
3014
3102
|
|
3015
3103
|
context "for an invalid Macedonian IBAN" do
|
3016
3104
|
let(:iban_code) { "MK972 5012 0000 0589 84" }
|
3105
|
+
|
3017
3106
|
it { is_expected.to_not be_valid }
|
3018
3107
|
end
|
3019
3108
|
|
3020
3109
|
context "for a valid Maltese IBAN" do
|
3021
3110
|
let(:iban_code) { "MT84 MALT 0110 0001 2345 MTLC AST0 01S" }
|
3111
|
+
|
3022
3112
|
it { is_expected.to be_valid }
|
3023
3113
|
end
|
3024
3114
|
|
3025
3115
|
context "for an invalid Maltese IBAN" do
|
3026
3116
|
let(:iban_code) { "MT94 MALT 0110 0001 2345 MTLC AST0 01S" }
|
3117
|
+
|
3027
3118
|
it { is_expected.to_not be_valid }
|
3028
3119
|
end
|
3029
3120
|
|
3030
3121
|
context "for a valid Maurititanian IBAN" do
|
3031
3122
|
let(:iban_code) { "MU17 BOMM 0101 1010 3030 0200 000M UR" }
|
3123
|
+
|
3032
3124
|
it { is_expected.to be_valid }
|
3033
3125
|
end
|
3034
3126
|
|
3035
3127
|
context "for an invalid Maurititanian IBAN" do
|
3036
3128
|
let(:iban_code) { "MU97 BOMM 0101 1010 3030 0200 000M UR" }
|
3129
|
+
|
3037
3130
|
it { is_expected.to_not be_valid }
|
3038
3131
|
end
|
3039
3132
|
|
3040
3133
|
context "for a valid Moldovan IBAN" do
|
3041
3134
|
let(:iban_code) { "MD24 AG00 0225 1000 1310 4168" }
|
3135
|
+
|
3042
3136
|
it { is_expected.to be_valid }
|
3043
3137
|
end
|
3044
3138
|
|
3045
3139
|
context "for an invalid Moldovan IBAN" do
|
3046
3140
|
let(:iban_code) { "MD94 AG00 0225 1000 1310 4168" }
|
3141
|
+
|
3047
3142
|
it { is_expected.to_not be_valid }
|
3048
3143
|
end
|
3049
3144
|
|
3050
3145
|
context "for a valid Monocan IBAN" do
|
3051
3146
|
let(:iban_code) { "MC93 2005 2222 1001 1223 3M44 555" }
|
3147
|
+
|
3052
3148
|
it { is_expected.to be_valid }
|
3053
3149
|
end
|
3054
3150
|
|
3055
3151
|
context "for an invalid Monocan IBAN" do
|
3056
3152
|
let(:iban_code) { "MC23 2005 2222 1001 1223 3M44 555" }
|
3153
|
+
|
3057
3154
|
it { is_expected.to_not be_valid }
|
3058
3155
|
end
|
3059
3156
|
|
3060
3157
|
context "for a valid Montenegrian IBAN" do
|
3061
3158
|
let(:iban_code) { "ME25 5050 0001 2345 6789 51" }
|
3159
|
+
|
3062
3160
|
it { is_expected.to be_valid }
|
3063
3161
|
end
|
3064
3162
|
|
3065
3163
|
context "for an invalid Montenegrian IBAN" do
|
3066
3164
|
let(:iban_code) { "ME95 5050 0001 2345 6789 51" }
|
3165
|
+
|
3067
3166
|
it { is_expected.to_not be_valid }
|
3068
3167
|
end
|
3069
3168
|
|
3070
3169
|
context "for a valid Dutch IBAN" do
|
3071
3170
|
let(:iban_code) { "NL39 RABO 0300 0652 64" }
|
3171
|
+
|
3072
3172
|
it { is_expected.to be_valid }
|
3073
3173
|
end
|
3074
3174
|
|
3075
3175
|
context "for an invalid Dutch IBAN" do
|
3076
3176
|
let(:iban_code) { "NL99 RABO 0300 0652 64" }
|
3177
|
+
|
3077
3178
|
it { is_expected.to_not be_valid }
|
3078
3179
|
end
|
3079
3180
|
|
3080
3181
|
context "for a valid Norwegian IBAN" do
|
3081
3182
|
let(:iban_code) { "NO93 8601 1117 947" }
|
3183
|
+
|
3082
3184
|
it { is_expected.to be_valid }
|
3083
3185
|
end
|
3084
3186
|
|
3085
3187
|
context "for an invalid Norwegian IBAN" do
|
3086
3188
|
let(:iban_code) { "NO23 8601 1117 947" }
|
3189
|
+
|
3087
3190
|
it { is_expected.to_not be_valid }
|
3088
3191
|
end
|
3089
3192
|
|
3090
3193
|
context "for a valid New Zealand pseudo-IBAN" do
|
3091
3194
|
let(:iban_code) { "NZZZ5566667777777088" }
|
3195
|
+
|
3092
3196
|
it { is_expected.to be_valid }
|
3093
3197
|
end
|
3094
3198
|
|
3095
3199
|
context "for an invalid New Zealand pseudo-IBAN" do
|
3096
3200
|
let(:iban_code) { "NZZZ55666677777770888" }
|
3201
|
+
|
3097
3202
|
it { is_expected.to_not be_valid }
|
3098
3203
|
end
|
3099
3204
|
|
3100
3205
|
context "for a valid Pakistani IBAN" do
|
3101
3206
|
let(:iban_code) { "PK36 SCBL 0000 0011 2345 6702" }
|
3207
|
+
|
3102
3208
|
it { is_expected.to be_valid }
|
3103
3209
|
end
|
3104
3210
|
|
3105
3211
|
context "for an invalid Pakistani IBAN" do
|
3106
3212
|
let(:iban_code) { "PK96 SCBL 0000 0011 2345 6702" }
|
3213
|
+
|
3107
3214
|
it { is_expected.to_not be_valid }
|
3108
3215
|
end
|
3109
3216
|
|
3110
3217
|
context "for a valid Polish IBAN" do
|
3111
3218
|
let(:iban_code) { "PL60 1020 1026 0000 0422 7020 1111" }
|
3219
|
+
|
3112
3220
|
it { is_expected.to be_valid }
|
3113
3221
|
end
|
3114
3222
|
|
3115
3223
|
context "for an invalid Polish IBAN" do
|
3116
3224
|
let(:iban_code) { "PL90 1020 1026 0000 0422 7020 1111" }
|
3225
|
+
|
3117
3226
|
it { is_expected.to_not be_valid }
|
3118
3227
|
end
|
3119
3228
|
|
3120
3229
|
context "for a valid Potuguese IBAN" do
|
3121
3230
|
let(:iban_code) { "PT50 0002 0123 1234 5678 9015 4" }
|
3231
|
+
|
3122
3232
|
it { is_expected.to be_valid }
|
3123
3233
|
end
|
3124
3234
|
|
3125
3235
|
context "for an invalid Potuguese IBAN" do
|
3126
3236
|
let(:iban_code) { "PT90 0002 0123 1234 5678 9015 4" }
|
3237
|
+
|
3127
3238
|
it { is_expected.to_not be_valid }
|
3128
3239
|
end
|
3129
3240
|
|
3130
3241
|
context "for a valid Qatari IBAN" do
|
3131
3242
|
let(:iban_code) { "QA58 DOHB 0000 1234 5678 90AB CDEF G" }
|
3243
|
+
|
3132
3244
|
it { is_expected.to be_valid }
|
3133
3245
|
end
|
3134
3246
|
|
3135
3247
|
context "for an invalid Qatari IBAN" do
|
3136
3248
|
let(:iban_code) { "QA98 DOHB 0000 1234 5678 90AB CDEF G" }
|
3249
|
+
|
3137
3250
|
it { is_expected.to_not be_valid }
|
3138
3251
|
end
|
3139
3252
|
|
3140
3253
|
context "for a valid Romanian IBAN" do
|
3141
3254
|
let(:iban_code) { "RO49 AAAA 1B31 0075 9384 0000" }
|
3255
|
+
|
3142
3256
|
it { is_expected.to be_valid }
|
3143
3257
|
end
|
3144
3258
|
|
3145
3259
|
context "for an invalid Romanian IBAN" do
|
3146
3260
|
let(:iban_code) { "RO99 AAAA 1B31 0075 9384 0000" }
|
3261
|
+
|
3147
3262
|
it { is_expected.to_not be_valid }
|
3148
3263
|
end
|
3149
3264
|
|
3150
3265
|
context "for a valid San Marinian IBAN" do
|
3151
3266
|
let(:iban_code) { "SM86 U032 2509 8000 0000 0270 100" }
|
3267
|
+
|
3152
3268
|
it { is_expected.to be_valid }
|
3153
3269
|
end
|
3154
3270
|
|
3155
3271
|
context "for an invalid San Marinian IBAN" do
|
3156
3272
|
let(:iban_code) { "SM96 U032 2509 8000 0000 0270 100" }
|
3273
|
+
|
3157
3274
|
it { is_expected.to_not be_valid }
|
3158
3275
|
end
|
3159
3276
|
|
3160
3277
|
context "for a valid Saudi IBAN" do
|
3161
3278
|
let(:iban_code) { "SA03 8000 0000 6080 1016 7519" }
|
3279
|
+
|
3162
3280
|
it { is_expected.to be_valid }
|
3163
3281
|
end
|
3164
3282
|
|
3165
3283
|
context "for an invalid Saudi IBAN" do
|
3166
3284
|
let(:iban_code) { "SA93 8000 0000 6080 1016 7519" }
|
3285
|
+
|
3167
3286
|
it { is_expected.to_not be_valid }
|
3168
3287
|
end
|
3169
3288
|
|
3170
3289
|
context "for a valid Serbian IBAN" do
|
3171
3290
|
let(:iban_code) { "RS35 2600 0560 1001 6113 79" }
|
3291
|
+
|
3172
3292
|
it { is_expected.to be_valid }
|
3173
3293
|
end
|
3174
3294
|
|
3175
3295
|
context "for an invalid Serbian IBAN" do
|
3176
3296
|
let(:iban_code) { "RS95 2600 0560 1001 6113 79" }
|
3297
|
+
|
3177
3298
|
it { is_expected.to_not be_valid }
|
3178
3299
|
end
|
3179
3300
|
|
3180
3301
|
context "for a valid Slovakian IBAN" do
|
3181
3302
|
let(:iban_code) { "SK31 1200 0000 1987 4263 7541" }
|
3303
|
+
|
3182
3304
|
it { is_expected.to be_valid }
|
3183
3305
|
end
|
3184
3306
|
|
3185
3307
|
context "for an invalid Slovakian IBAN" do
|
3186
3308
|
let(:iban_code) { "SK91 1200 0000 1987 4263 7541" }
|
3309
|
+
|
3187
3310
|
it { is_expected.to_not be_valid }
|
3188
3311
|
end
|
3189
3312
|
|
3190
3313
|
context "for a valid Slovenian IBAN" do
|
3191
3314
|
let(:iban_code) { "SI56 1910 0000 0123 438" }
|
3315
|
+
|
3192
3316
|
it { is_expected.to be_valid }
|
3193
3317
|
end
|
3194
3318
|
|
3195
3319
|
context "for an invalid Slovenian IBAN" do
|
3196
3320
|
let(:iban_code) { "SI96 1910 0000 0123 438" }
|
3321
|
+
|
3197
3322
|
it { is_expected.to_not be_valid }
|
3198
3323
|
end
|
3199
3324
|
|
3200
3325
|
context "for a valid Spanish IBAN" do
|
3201
3326
|
let(:iban_code) { "ES80 2310 0001 1800 0001 2345" }
|
3327
|
+
|
3202
3328
|
it { is_expected.to be_valid }
|
3203
3329
|
end
|
3204
3330
|
|
3205
3331
|
context "for an invalid Spanish IBAN" do
|
3206
3332
|
let(:iban_code) { "ES90 2310 0001 1800 0001 2345" }
|
3333
|
+
|
3207
3334
|
it { is_expected.to_not be_valid }
|
3208
3335
|
end
|
3209
3336
|
|
3210
3337
|
context "for a valid Swedish IBAN" do
|
3211
3338
|
let(:iban_code) { "SE35 5000 0000 0549 1000 0003" }
|
3339
|
+
|
3212
3340
|
it { is_expected.to be_valid }
|
3213
3341
|
end
|
3214
3342
|
|
3215
3343
|
context "for an invalid Swedish IBAN" do
|
3216
3344
|
let(:iban_code) { "SE95 5000 0000 0549 1000 0003" }
|
3345
|
+
|
3217
3346
|
it { is_expected.to_not be_valid }
|
3218
3347
|
end
|
3219
3348
|
|
3220
3349
|
context "for a valid Swiss IBAN" do
|
3221
3350
|
let(:iban_code) { "CH93 0076 2011 6238 5295 7" }
|
3351
|
+
|
3222
3352
|
it { is_expected.to be_valid }
|
3223
3353
|
end
|
3224
3354
|
|
3225
3355
|
context "for an invalid Swiss IBAN" do
|
3226
3356
|
let(:iban_code) { "CH23 0076 2011 6238 5295 7" }
|
3357
|
+
|
3227
3358
|
it { is_expected.to_not be_valid }
|
3228
3359
|
end
|
3229
3360
|
|
3230
3361
|
context "for a valid Tunisian IBAN" do
|
3231
3362
|
let(:iban_code) { "TN59 1000 6035 1835 9847 8831" }
|
3363
|
+
|
3232
3364
|
it { is_expected.to be_valid }
|
3233
3365
|
end
|
3234
3366
|
|
3235
3367
|
context "for an invalid Tunisian IBAN" do
|
3236
3368
|
let(:iban_code) { "TN99 1000 6035 1835 9847 8831" }
|
3369
|
+
|
3237
3370
|
it { is_expected.to_not be_valid }
|
3238
3371
|
end
|
3239
3372
|
|
3240
3373
|
context "for a valid Turkish IBAN" do
|
3241
3374
|
let(:iban_code) { "TR33 0006 1005 1978 6457 8413 26" }
|
3375
|
+
|
3242
3376
|
it { is_expected.to be_valid }
|
3243
3377
|
end
|
3244
3378
|
|
3245
3379
|
context "for an invalid Turkish IBAN" do
|
3246
3380
|
let(:iban_code) { "TR93 0006 1005 1978 6457 8413 26" }
|
3381
|
+
|
3247
3382
|
it { is_expected.to_not be_valid }
|
3248
3383
|
end
|
3249
3384
|
|
3250
3385
|
context "for a valid UAE IBAN" do
|
3251
3386
|
let(:iban_code) { "AE07 0331 2345 6789 0123 456" }
|
3387
|
+
|
3252
3388
|
it { is_expected.to be_valid }
|
3253
3389
|
end
|
3254
3390
|
|
3255
3391
|
context "for an invalid UAE IBAN" do
|
3256
3392
|
let(:iban_code) { "AE97 0331 2345 6789 0123 456" }
|
3393
|
+
|
3257
3394
|
it { is_expected.to_not be_valid }
|
3258
3395
|
end
|
3259
3396
|
|
3260
3397
|
context "for a valid UK IBAN" do
|
3261
3398
|
let(:iban_code) { "GB82 WEST 1234 5698 7654 32" }
|
3399
|
+
|
3262
3400
|
it { is_expected.to be_valid }
|
3263
3401
|
end
|
3264
3402
|
|
3265
3403
|
context "for an invalid UK IBAN" do
|
3266
3404
|
let(:iban_code) { "GB92 WEST 1234 5698 7654 32" }
|
3405
|
+
|
3267
3406
|
it { is_expected.to_not be_valid }
|
3268
3407
|
end
|
3269
3408
|
end
|
@@ -3271,61 +3410,73 @@ describe Ibandit::IBAN do
|
|
3271
3410
|
describe "#local_check_digits" do
|
3272
3411
|
context "with a Belgian IBAN" do
|
3273
3412
|
let(:iban_code) { "BE62510007547061" }
|
3413
|
+
|
3274
3414
|
its(:local_check_digits) { is_expected.to eq("61") }
|
3275
3415
|
end
|
3276
3416
|
|
3277
3417
|
context "with a French IBAN" do
|
3278
3418
|
let(:iban_code) { "FR1234567890123456789012345" }
|
3419
|
+
|
3279
3420
|
its(:local_check_digits) { is_expected.to eq("45") }
|
3280
3421
|
end
|
3281
3422
|
|
3282
3423
|
context "with a Monocan IBAN" do
|
3283
3424
|
let(:iban_code) { "MC9320052222100112233M44555" }
|
3425
|
+
|
3284
3426
|
its(:local_check_digits) { is_expected.to eq("55") }
|
3285
3427
|
end
|
3286
3428
|
|
3287
3429
|
context "with a Spanish IBAN" do
|
3288
3430
|
let(:iban_code) { "ES1212345678911234567890" }
|
3431
|
+
|
3289
3432
|
its(:local_check_digits) { is_expected.to eq("91") }
|
3290
3433
|
end
|
3291
3434
|
|
3292
3435
|
context "with an Italian IBAN" do
|
3293
3436
|
let(:iban_code) { "IT12A1234567890123456789012" }
|
3437
|
+
|
3294
3438
|
its(:local_check_digits) { is_expected.to eq("A") }
|
3295
3439
|
end
|
3296
3440
|
|
3297
3441
|
context "with an Estonian IBAN" do
|
3298
3442
|
let(:iban_code) { "EE382200221020145685" }
|
3443
|
+
|
3299
3444
|
its(:local_check_digits) { is_expected.to eq("5") }
|
3300
3445
|
end
|
3301
3446
|
|
3302
3447
|
context "with an Finnish IBAN" do
|
3303
3448
|
let(:iban_code) { "FI2112345600000785" }
|
3449
|
+
|
3304
3450
|
its(:local_check_digits) { is_expected.to eq("5") }
|
3305
3451
|
end
|
3306
3452
|
|
3307
3453
|
context "with an Portuguese IBAN" do
|
3308
3454
|
let(:iban_code) { "PT50000201231234567890154" }
|
3455
|
+
|
3309
3456
|
its(:local_check_digits) { is_expected.to eq("54") }
|
3310
3457
|
end
|
3311
3458
|
|
3312
3459
|
context "with a Norwegian IBAN" do
|
3313
3460
|
let(:iban_code) { "NO9386011117947" }
|
3461
|
+
|
3314
3462
|
its(:local_check_digits) { is_expected.to eq("7") }
|
3315
3463
|
end
|
3316
3464
|
|
3317
3465
|
context "with an Icelandic IBAN" do
|
3318
3466
|
let(:iban_code) { "IS250311260024684606972049" }
|
3467
|
+
|
3319
3468
|
its(:local_check_digits) { is_expected.to eq("4") }
|
3320
3469
|
end
|
3321
3470
|
|
3322
3471
|
context "with a Slovakian IBAN" do
|
3323
3472
|
let(:iban_code) { "SK3112000000198742637541" }
|
3473
|
+
|
3324
3474
|
its(:local_check_digits) { is_expected.to eq("9") }
|
3325
3475
|
end
|
3326
3476
|
|
3327
3477
|
context "with a Dutch IBAN" do
|
3328
3478
|
let(:iban_code) { "NL91ABNA0417164300" }
|
3479
|
+
|
3329
3480
|
its(:local_check_digits) { is_expected.to eq("0") }
|
3330
3481
|
end
|
3331
3482
|
end
|