ibandit 0.11.22 → 0.11.23

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,7 +5,6 @@ describe Ibandit::IBANSplitter do
5
5
 
6
6
  context "with a valid IBAN" do
7
7
  let(:iban_code) { "GB82WEST12345698765432" }
8
-
9
8
  its([:country_code]) { is_expected.to eq("GB") }
10
9
  its([:check_digits]) { is_expected.to eq("82") }
11
10
  its([:bank_code]) { is_expected.to eq("WEST") }
@@ -15,7 +14,6 @@ describe Ibandit::IBANSplitter do
15
14
 
16
15
  context "with nil" do
17
16
  let(:iban_code) { nil }
18
-
19
17
  its([:country_code]) { is_expected.to eq(nil) }
20
18
  its([:check_digits]) { is_expected.to eq(nil) }
21
19
  its([:bank_code]) { is_expected.to eq(nil) }
@@ -25,7 +23,6 @@ describe Ibandit::IBANSplitter do
25
23
 
26
24
  context "with an empty string" do
27
25
  let(:iban_code) { "" }
28
-
29
26
  its([:country_code]) { is_expected.to eq(nil) }
30
27
  its([:check_digits]) { is_expected.to eq(nil) }
31
28
  its([:bank_code]) { is_expected.to eq(nil) }
@@ -35,7 +32,6 @@ describe Ibandit::IBANSplitter do
35
32
 
36
33
  context "with an invalid length IBAN" do
37
34
  let(:iban_code) { "MC9320052222100112233M445" }
38
-
39
35
  its([:country_code]) { is_expected.to eq("MC") }
40
36
  its([:check_digits]) { is_expected.to eq(nil) }
41
37
  its([:bank_code]) { is_expected.to eq(nil) }
@@ -2,7 +2,6 @@ require "spec_helper"
2
2
 
3
3
  describe Ibandit::LocalDetailsCleaner do
4
4
  subject(:cleaned) { described_class.clean(local_details) }
5
-
6
5
  let(:local_details) do
7
6
  {
8
7
  country_code: country_code,
@@ -31,7 +30,6 @@ describe Ibandit::LocalDetailsCleaner do
31
30
 
32
31
  context "with an unsupported country code" do
33
32
  let(:country_code) { "FU" }
34
-
35
33
  it { is_expected.to eq(local_details_with_swift) }
36
34
  end
37
35
 
@@ -44,43 +42,36 @@ describe Ibandit::LocalDetailsCleaner do
44
42
 
45
43
  context "with an account number which needs zero-padding" do
46
44
  let(:account_number) { "234573201" }
47
-
48
45
  its([:account_number]) { is_expected.to eq("00234573201") }
49
46
  end
50
47
 
51
48
  context "with an account number under 4 digits" do
52
49
  let(:account_number) { "123" }
53
-
54
50
  its([:account_number]) { is_expected.to eq("123") }
55
51
  end
56
52
 
57
53
  context "with a long account number" do
58
54
  let(:account_number) { "234573201999" }
59
-
60
55
  it { is_expected.to eq(local_details_with_swift) }
61
56
  end
62
57
 
63
58
  context "without an account number" do
64
59
  let(:account_number) { nil }
65
-
66
60
  it { is_expected.to eq(local_details_with_swift) }
67
61
  end
68
62
 
69
63
  context "with a short bank code" do
70
64
  let(:bank_code) { "1904" }
71
-
72
65
  it { is_expected.to eq(local_details_with_swift) }
73
66
  end
74
67
 
75
68
  context "with a long bank code" do
76
69
  let(:bank_code) { "190430" }
77
-
78
70
  it { is_expected.to eq(local_details_with_swift) }
79
71
  end
80
72
 
81
73
  context "without a bank code" do
82
74
  let(:bank_code) { nil }
83
-
84
75
  it { is_expected.to eq(local_details_with_swift) }
85
76
  end
86
77
  end
@@ -116,14 +107,12 @@ describe Ibandit::LocalDetailsCleaner do
116
107
 
117
108
  context "with dashes" do
118
109
  let(:account_number) { "510-0075470-61" }
119
-
120
110
  its([:bank_code]) { is_expected.to eq("510") }
121
111
  its([:account_number]) { is_expected.to eq("510007547061") }
122
112
  end
123
113
 
124
114
  context "without an account number" do
125
115
  let(:account_number) { nil }
126
-
127
116
  it { is_expected.to eq(local_details_with_swift) }
128
117
  end
129
118
  end
@@ -138,19 +127,16 @@ describe Ibandit::LocalDetailsCleaner do
138
127
 
139
128
  context "without an account number" do
140
129
  let(:account_number) { nil }
141
-
142
130
  it { is_expected.to eq(local_details_with_swift) }
143
131
  end
144
132
 
145
133
  context "without a branch code" do
146
134
  let(:branch_code) { nil }
147
-
148
135
  it { is_expected.to eq(local_details_with_swift) }
149
136
  end
150
137
 
151
138
  context "without a bank code" do
152
139
  let(:bank_code) { nil }
153
-
154
140
  it { is_expected.to eq(local_details_with_swift) }
155
141
  end
156
142
  end
@@ -177,39 +163,33 @@ describe Ibandit::LocalDetailsCleaner do
177
163
 
178
164
  context "with a short account number" do
179
165
  let(:account_number) { "1200527600" }
180
-
181
166
  its([:account_number]) { is_expected.to eq("0000001200527600") }
182
167
  end
183
168
 
184
169
  context "with a too-short account number" do
185
170
  let(:account_number) { "123456" }
186
-
187
171
  its([:account_number]) { is_expected.to eq(account_number) }
188
172
  end
189
173
 
190
174
  context "with a long account number" do
191
175
  let(:account_number) { "00000001200527600" }
192
-
193
176
  it { is_expected.to eq(local_details_with_swift) }
194
177
  end
195
178
 
196
179
  context "without an account number" do
197
180
  let(:account_number) { nil }
198
-
199
181
  it { is_expected.to eq(local_details_with_swift) }
200
182
  end
201
183
 
202
184
  context "with the branch code in the bank code field" do
203
185
  let(:bank_code) { "002 00128" }
204
186
  let(:branch_code) { nil }
205
-
206
187
  its([:bank_code]) { is_expected.to eq("002") }
207
188
  its([:branch_code]) { is_expected.to eq("00128") }
208
189
  end
209
190
 
210
191
  context "without a bank code" do
211
192
  let(:bank_code) { nil }
212
-
213
193
  it { is_expected.to eq(local_details_with_swift) }
214
194
  end
215
195
  end
@@ -224,27 +204,23 @@ describe Ibandit::LocalDetailsCleaner do
224
204
  context "with an account number prefix" do
225
205
  let(:prefix) { "000019" }
226
206
  let(:account_number) { "2000145399" }
227
-
228
207
  before { local_details.merge!(account_number_prefix: prefix) }
229
208
 
230
209
  its([:account_number]) { is_expected.to eq("0000192000145399") }
231
210
 
232
211
  context "which needs zero-padding" do
233
212
  let(:prefix) { "19" }
234
-
235
213
  its([:account_number]) { is_expected.to eq("0000192000145399") }
236
214
  end
237
215
  end
238
216
 
239
217
  context "without a bank code" do
240
218
  let(:bank_code) { nil }
241
-
242
219
  it { is_expected.to eq(local_details_with_swift) }
243
220
  end
244
221
 
245
222
  context "without an account number" do
246
223
  let(:account_number) { nil }
247
-
248
224
  it { is_expected.to eq(local_details_with_swift) }
249
225
  end
250
226
  end
@@ -258,26 +234,22 @@ describe Ibandit::LocalDetailsCleaner do
258
234
 
259
235
  context "without a bank code" do
260
236
  let(:bank_code) { nil }
261
-
262
237
  it { is_expected.to eq(local_details_with_swift) }
263
238
  end
264
239
 
265
240
  context "without an account number" do
266
241
  let(:account_number) { nil }
267
-
268
242
  it { is_expected.to eq(local_details_with_swift) }
269
243
  end
270
244
 
271
245
  context "with an excessively short account number" do
272
246
  let(:account_number) { "666" }
273
-
274
247
  its([:account_number]) { is_expected.to eq(account_number) }
275
248
  end
276
249
 
277
250
  context "with a pseudo account number" do
278
251
  let(:bank_code) { "37080040" }
279
252
  let(:account_number) { "111" }
280
-
281
253
  its([:bank_code]) { is_expected.to eq(bank_code) }
282
254
  its([:account_number]) { is_expected.to eq("0215022000") }
283
255
  end
@@ -285,7 +257,6 @@ describe Ibandit::LocalDetailsCleaner do
285
257
  context "with unsupported account details" do
286
258
  let(:account_number) { "7955791111" }
287
259
  let(:bank_code) { "20000000" }
288
-
289
260
  it { is_expected.to eq(local_details_with_swift) }
290
261
  end
291
262
  end
@@ -326,7 +297,6 @@ describe Ibandit::LocalDetailsCleaner do
326
297
 
327
298
  context "without an account number" do
328
299
  let(:account_number) { nil }
329
-
330
300
  it { is_expected.to eq(local_details_with_swift) }
331
301
  end
332
302
  end
@@ -340,14 +310,12 @@ describe Ibandit::LocalDetailsCleaner do
340
310
 
341
311
  context "with an account number that needs translating" do
342
312
  let(:account_number) { "111020145685" }
343
-
344
313
  its([:bank_code]) { is_expected.to eq("22") }
345
314
  its([:account_number]) { is_expected.to eq("00111020145685") }
346
315
  end
347
316
 
348
317
  context "without an account number" do
349
318
  let(:account_number) { nil }
350
-
351
319
  it { is_expected.to eq(local_details_with_swift) }
352
320
  end
353
321
  end
@@ -372,13 +340,11 @@ describe Ibandit::LocalDetailsCleaner do
372
340
 
373
341
  context "with spaces in the account number" do
374
342
  let(:account_number) { "18 0000012345" }
375
-
376
343
  its([:account_number]) { is_expected.to eq("180000012345") }
377
344
  end
378
345
 
379
346
  context "without an account number" do
380
347
  let(:account_number) { nil }
381
-
382
348
  it { is_expected.to eq(local_details_with_swift) }
383
349
  end
384
350
  end
@@ -392,7 +358,6 @@ describe Ibandit::LocalDetailsCleaner do
392
358
 
393
359
  context "with a shorter account number" do
394
360
  let(:account_number) { "785" }
395
-
396
361
  its([:account_number]) { is_expected.to eq("00000785") }
397
362
  end
398
363
 
@@ -406,13 +371,11 @@ describe Ibandit::LocalDetailsCleaner do
406
371
 
407
372
  context "without an account number" do
408
373
  let(:account_number) { nil }
409
-
410
374
  it { is_expected.to eq(local_details_with_swift) }
411
375
  end
412
376
 
413
377
  context "without a bank code" do
414
378
  let(:bank_code) { nil }
415
-
416
379
  it { is_expected.to eq(local_details_with_swift) }
417
380
  end
418
381
  end
@@ -427,37 +390,31 @@ describe Ibandit::LocalDetailsCleaner do
427
390
 
428
391
  context "with the RIB key spaced in the account number" do
429
392
  let(:account_number) { "0500013M026 06" }
430
-
431
393
  its([:account_number]) { is_expected.to eq("0500013M02606") }
432
394
  end
433
395
 
434
396
  context "with the RIB key hyphenated in the account number" do
435
397
  let(:account_number) { "0500013M026-06" }
436
-
437
398
  its([:account_number]) { is_expected.to eq("0500013M02606") }
438
399
  end
439
400
 
440
401
  context "with the RIB key missing" do
441
402
  let(:account_number) { "0500013M026" }
442
-
443
403
  it { is_expected.to eq(local_details_with_swift) }
444
404
  end
445
405
 
446
406
  context "without a bank code" do
447
407
  let(:bank_code) { nil }
448
-
449
408
  it { is_expected.to eq(local_details_with_swift) }
450
409
  end
451
410
 
452
411
  context "without a branch code" do
453
412
  let(:branch_code) { nil }
454
-
455
413
  it { is_expected.to eq(local_details_with_swift) }
456
414
  end
457
415
 
458
416
  context "without an account number" do
459
417
  let(:account_number) { nil }
460
-
461
418
  it { is_expected.to eq(local_details_with_swift) }
462
419
  end
463
420
  end
@@ -472,62 +429,52 @@ describe Ibandit::LocalDetailsCleaner do
472
429
 
473
430
  context "with the sort code is hyphenated" do
474
431
  let(:branch_code) { "20-00-00" }
475
-
476
432
  its([:branch_code]) { is_expected.to eq("200000") }
477
433
  its([:swift_branch_code]) { is_expected.to eq("200000") }
478
434
  end
479
435
 
480
436
  context "with the sort code spaced" do
481
437
  let(:branch_code) { "20 00 00" }
482
-
483
438
  its([:branch_code]) { is_expected.to eq("200000") }
484
439
  end
485
440
 
486
441
  context "with a short account number" do
487
442
  let(:account_number) { "579135" }
488
-
489
443
  its([:account_number]) { is_expected.to eq("00579135") }
490
444
  its([:swift_account_number]) { is_expected.to eq("00579135") }
491
445
  end
492
446
 
493
447
  context "with a too-short account number" do
494
448
  let(:account_number) { "5678" }
495
-
496
449
  its([:account_number]) { is_expected.to eq(account_number) }
497
450
  end
498
451
 
499
452
  context "with the account number spaced" do
500
453
  let(:account_number) { "5577 9911" }
501
-
502
454
  its([:account_number]) { is_expected.to eq("55779911") }
503
455
  end
504
456
 
505
457
  context "with the account number hyphenated" do
506
458
  let(:account_number) { "5577-9911" }
507
-
508
459
  its([:account_number]) { is_expected.to eq("55779911") }
509
460
  end
510
461
 
511
462
  context "without a branch code" do
512
463
  let(:branch_code) { nil }
513
-
514
464
  it { is_expected.to eq(local_details_with_swift) }
515
465
  end
516
466
 
517
467
  context "without a bank code" do
518
468
  let(:bank_code) { nil }
519
-
520
469
  it { is_expected.to eq(local_details_with_swift) }
521
470
 
522
471
  context "with a BIC finder set" do
523
472
  let(:bic_finder) { double }
524
-
525
473
  before do
526
474
  allow(bic_finder).to receive(:call).with("GB", "200000").
527
475
  and_return("BARCGB22XXX")
528
476
  Ibandit.bic_finder = bic_finder
529
477
  end
530
-
531
478
  after { Ibandit.bic_finder = nil }
532
479
 
533
480
  its([:bank_code]) { is_expected.to eq("BARC") }
@@ -538,13 +485,11 @@ describe Ibandit::LocalDetailsCleaner do
538
485
  context "with a bank code and BIC finder set" do
539
486
  let(:bank_code) { "OVERRIDE" }
540
487
  let(:bic_finder) { double }
541
-
542
488
  before do
543
489
  allow(bic_finder).to receive(:call).with("GB", "200000").
544
490
  and_return("BARCGB22XXX")
545
491
  Ibandit.bic_finder = bic_finder
546
492
  end
547
-
548
493
  after { Ibandit.bic_finder = nil }
549
494
 
550
495
  its([:bank_code]) { is_expected.to eq("OVERRIDE") }
@@ -561,19 +506,16 @@ describe Ibandit::LocalDetailsCleaner do
561
506
 
562
507
  context "without an account number" do
563
508
  let(:account_number) { nil }
564
-
565
509
  it { is_expected.to eq(local_details_with_swift) }
566
510
  end
567
511
 
568
512
  context "without a bank code" do
569
513
  let(:bank_code) { nil }
570
-
571
514
  it { is_expected.to eq(local_details_with_swift) }
572
515
  end
573
516
 
574
517
  context "without a branch code" do
575
518
  let(:branch_code) { nil }
576
-
577
519
  it { is_expected.to eq(local_details_with_swift) }
578
520
  end
579
521
  end
@@ -595,14 +537,12 @@ describe Ibandit::LocalDetailsCleaner do
595
537
 
596
538
  context "with a badly formatted account number" do
597
539
  let(:account_number) { "1863000160" }
598
-
599
540
  it { is_expected.to eq(local_details_with_swift) }
600
541
  end
601
542
  end
602
543
 
603
544
  context "without an account number" do
604
545
  let(:account_number) { nil }
605
-
606
546
  it { is_expected.to eq(local_details_with_swift) }
607
547
  end
608
548
  end
@@ -637,21 +577,18 @@ describe Ibandit::LocalDetailsCleaner do
637
577
 
638
578
  context "with an invalid length account number" do
639
579
  let(:account_number) { "11773016-1111101" }
640
-
641
580
  it { is_expected.to eq(local_details_with_swift) }
642
581
  end
643
582
 
644
583
  context "with a bank code, too" do
645
584
  let(:account_number) { "11773016-11111018" }
646
585
  let(:bank_code) { "117" }
647
-
648
586
  it { is_expected.to eq(local_details_with_swift) }
649
587
  end
650
588
  end
651
589
 
652
590
  context "without an account number" do
653
591
  let(:account_number) { nil }
654
-
655
592
  it { is_expected.to eq(local_details_with_swift) }
656
593
  end
657
594
  end
@@ -666,60 +603,50 @@ describe Ibandit::LocalDetailsCleaner do
666
603
 
667
604
  context "with the sort code is hyphenated" do
668
605
  let(:branch_code) { "93-11-52" }
669
-
670
606
  its([:branch_code]) { is_expected.to eq("931152") }
671
607
  end
672
608
 
673
609
  context "with the sort code spaced" do
674
610
  let(:branch_code) { "93 11 52" }
675
-
676
611
  its([:branch_code]) { is_expected.to eq("931152") }
677
612
  end
678
613
 
679
614
  context "with a short account number" do
680
615
  let(:account_number) { "579135" }
681
-
682
616
  its([:account_number]) { is_expected.to eq("00579135") }
683
617
  end
684
618
 
685
619
  context "with a too-short account number" do
686
620
  let(:account_number) { "5678" }
687
-
688
621
  its([:account_number]) { is_expected.to eq(account_number) }
689
622
  end
690
623
 
691
624
  context "with the account number spaced" do
692
625
  let(:account_number) { "5577 9911" }
693
-
694
626
  its([:account_number]) { is_expected.to eq("55779911") }
695
627
  end
696
628
 
697
629
  context "with the account number hyphenated" do
698
630
  let(:account_number) { "5577-9911" }
699
-
700
631
  its([:account_number]) { is_expected.to eq("55779911") }
701
632
  end
702
633
 
703
634
  context "without a branch code" do
704
635
  let(:branch_code) { nil }
705
-
706
636
  it { is_expected.to eq(local_details_with_swift) }
707
637
  end
708
638
 
709
639
  context "without a bank code" do
710
640
  let(:bank_code) { nil }
711
-
712
641
  it { is_expected.to eq(local_details_with_swift) }
713
642
 
714
643
  context "with a BIC finder set" do
715
644
  let(:bic_finder) { double }
716
-
717
645
  before do
718
646
  allow(bic_finder).to receive(:call).with("IE", "931152").
719
647
  and_return("AIBKIE22XXX")
720
648
  Ibandit.bic_finder = bic_finder
721
649
  end
722
-
723
650
  after { Ibandit.bic_finder = nil }
724
651
 
725
652
  its([:bank_code]) { is_expected.to eq("AIBK") }
@@ -729,13 +656,11 @@ describe Ibandit::LocalDetailsCleaner do
729
656
  context "with a bank code and BIC finder set" do
730
657
  let(:bank_code) { "OVERRIDE" }
731
658
  let(:bic_finder) { double }
732
-
733
659
  before do
734
660
  allow(bic_finder).to receive(:call).with("IE", "931152").
735
661
  and_return("AIBKIE22XXX")
736
662
  Ibandit.bic_finder = bic_finder
737
663
  end
738
-
739
664
  after { Ibandit.bic_finder = nil }
740
665
 
741
666
  its([:bank_code]) { is_expected.to eq("OVERRIDE") }
@@ -778,14 +703,12 @@ describe Ibandit::LocalDetailsCleaner do
778
703
 
779
704
  context "without a hyphen" do
780
705
  let(:account_number) { "26-2468-606972049" }
781
-
782
706
  its([:account_number]) { is_expected.to eq("260024680606972049") }
783
707
  end
784
708
  end
785
709
 
786
710
  context "without an account number" do
787
711
  let(:account_number) { nil }
788
-
789
712
  it { is_expected.to eq(local_details_with_swift) }
790
713
  end
791
714
  end
@@ -800,31 +723,26 @@ describe Ibandit::LocalDetailsCleaner do
800
723
 
801
724
  context "with an explicit check digit" do
802
725
  before { local_details.merge!(check_digit: "Y") }
803
-
804
726
  it { is_expected.to eq(local_details_with_swift) }
805
727
  end
806
728
 
807
729
  context "with the account number not zero-padded" do
808
730
  let(:account_number) { "123456" }
809
-
810
731
  its([:account_number]) { is_expected.to eq("000000123456") }
811
732
  end
812
733
 
813
734
  context "without a bank code" do
814
735
  let(:bank_code) { nil }
815
-
816
736
  it { is_expected.to eq(local_details_with_swift) }
817
737
  end
818
738
 
819
739
  context "without a branch code" do
820
740
  let(:branch_code) { nil }
821
-
822
741
  it { is_expected.to eq(local_details_with_swift) }
823
742
  end
824
743
 
825
744
  context "without an account number" do
826
745
  let(:account_number) { nil }
827
-
828
746
  it { is_expected.to eq(local_details_with_swift) }
829
747
  end
830
748
  end
@@ -838,13 +756,11 @@ describe Ibandit::LocalDetailsCleaner do
838
756
 
839
757
  context "without an account number" do
840
758
  let(:account_number) { nil }
841
-
842
759
  it { is_expected.to eq(local_details_with_swift) }
843
760
  end
844
761
 
845
762
  context "without a bank code" do
846
763
  let(:bank_code) { nil }
847
-
848
764
  it { is_expected.to eq(local_details_with_swift) }
849
765
  end
850
766
  end
@@ -858,13 +774,11 @@ describe Ibandit::LocalDetailsCleaner do
858
774
 
859
775
  context "without an account number" do
860
776
  let(:account_number) { nil }
861
-
862
777
  it { is_expected.to eq(local_details_with_swift) }
863
778
  end
864
779
 
865
780
  context "without a bank code" do
866
781
  let(:bank_code) { nil }
867
-
868
782
  it { is_expected.to eq(local_details_with_swift) }
869
783
  end
870
784
  end
@@ -878,13 +792,11 @@ describe Ibandit::LocalDetailsCleaner do
878
792
 
879
793
  context "without an account number" do
880
794
  let(:account_number) { nil }
881
-
882
795
  it { is_expected.to eq(local_details_with_swift) }
883
796
  end
884
797
 
885
798
  context "without a bank code" do
886
799
  let(:bank_code) { nil }
887
-
888
800
  it { is_expected.to eq(local_details_with_swift) }
889
801
  end
890
802
  end
@@ -899,37 +811,31 @@ describe Ibandit::LocalDetailsCleaner do
899
811
 
900
812
  context "with the RIB key spaced in the account number" do
901
813
  let(:account_number) { "0500013M026 06" }
902
-
903
814
  its([:account_number]) { is_expected.to eq("0500013M02606") }
904
815
  end
905
816
 
906
817
  context "with the RIB key hyphenated in the account number" do
907
818
  let(:account_number) { "0500013M026-06" }
908
-
909
819
  its([:account_number]) { is_expected.to eq("0500013M02606") }
910
820
  end
911
821
 
912
822
  context "with the RIB key missing" do
913
823
  let(:account_number) { "0500013M026" }
914
-
915
824
  it { is_expected.to eq(local_details_with_swift) }
916
825
  end
917
826
 
918
827
  context "without a bank code" do
919
828
  let(:bank_code) { nil }
920
-
921
829
  it { is_expected.to eq(local_details_with_swift) }
922
830
  end
923
831
 
924
832
  context "without a branch code" do
925
833
  let(:branch_code) { nil }
926
-
927
834
  it { is_expected.to eq(local_details_with_swift) }
928
835
  end
929
836
 
930
837
  context "without an account number" do
931
838
  let(:account_number) { nil }
932
-
933
839
  it { is_expected.to eq(local_details_with_swift) }
934
840
  end
935
841
  end
@@ -944,36 +850,30 @@ describe Ibandit::LocalDetailsCleaner do
944
850
 
945
851
  context "with the account number spaced" do
946
852
  let(:account_number) { "9027 2930 51" }
947
-
948
853
  its([:account_number]) { is_expected.to eq("000000009027293051") }
949
854
  end
950
855
 
951
856
  context "with the account number hyphenated" do
952
857
  let(:account_number) { "9027-2930-51" }
953
-
954
858
  its([:account_number]) { is_expected.to eq("000000009027293051") }
955
859
  end
956
860
 
957
861
  context "without a branch code" do
958
862
  let(:branch_code) { nil }
959
-
960
863
  it { is_expected.to eq(local_details_with_swift) }
961
864
  end
962
865
 
963
866
  context "without a bank code" do
964
867
  let(:bank_code) { nil }
965
-
966
868
  it { is_expected.to eq(local_details_with_swift) }
967
869
 
968
870
  context "with a BIC finder set" do
969
871
  let(:bic_finder) { double }
970
-
971
872
  before do
972
873
  allow(bic_finder).to receive(:call).with("MT", "44093").
973
874
  and_return("MMEBMTMTXXX")
974
875
  Ibandit.bic_finder = bic_finder
975
876
  end
976
-
977
877
  after { Ibandit.bic_finder = nil }
978
878
 
979
879
  its([:bank_code]) { is_expected.to eq("MMEB") }
@@ -983,13 +883,11 @@ describe Ibandit::LocalDetailsCleaner do
983
883
  context "with a bank code and BIC finder set" do
984
884
  let(:bank_code) { "OVERRIDE" }
985
885
  let(:bic_finder) { double }
986
-
987
886
  before do
988
887
  allow(bic_finder).to receive(:call).with("MT", "44093").
989
888
  and_return("MMEBMTMTXXX")
990
889
  Ibandit.bic_finder = bic_finder
991
890
  end
992
-
993
891
  after { Ibandit.bic_finder = nil }
994
892
 
995
893
  its([:bank_code]) { is_expected.to eq("OVERRIDE") }
@@ -1005,25 +903,21 @@ describe Ibandit::LocalDetailsCleaner do
1005
903
 
1006
904
  context "without a bank code" do
1007
905
  let(:bank_code) { nil }
1008
-
1009
906
  it { is_expected.to eq(local_details_with_swift) }
1010
907
  end
1011
908
 
1012
909
  context "without a branch code" do
1013
910
  let(:branch_code) { nil }
1014
-
1015
911
  it { is_expected.to eq(local_details_with_swift) }
1016
912
  end
1017
913
 
1018
914
  context "without an account number" do
1019
915
  let(:account_number) { nil }
1020
-
1021
916
  it { is_expected.to eq(local_details_with_swift) }
1022
917
  end
1023
918
 
1024
919
  context "with an account number that needs zero-padding" do
1025
920
  let(:account_number) { "417164300" }
1026
-
1027
921
  its([:account_number]) { is_expected.to eq("0417164300") }
1028
922
  end
1029
923
  end
@@ -1046,7 +940,6 @@ describe Ibandit::LocalDetailsCleaner do
1046
940
 
1047
941
  context "without an account number" do
1048
942
  let(:account_number) { nil }
1049
-
1050
943
  it { is_expected.to eq(local_details_with_swift) }
1051
944
  end
1052
945
  end
@@ -1078,14 +971,12 @@ describe Ibandit::LocalDetailsCleaner do
1078
971
 
1079
972
  context "when the account number is shorter than 6 chars" do
1080
973
  let(:account_number) { "12345" }
1081
-
1082
974
  its([:account_number]) { is_expected.to be_nil }
1083
975
  end
1084
976
  end
1085
977
 
1086
978
  context "without an account number" do
1087
979
  let(:account_number) { nil }
1088
-
1089
980
  it { is_expected.to eq(local_details_with_swift) }
1090
981
  end
1091
982
  end
@@ -1108,7 +999,6 @@ describe Ibandit::LocalDetailsCleaner do
1108
999
 
1109
1000
  context "without an account number" do
1110
1001
  let(:account_number) { nil }
1111
-
1112
1002
  it { is_expected.to eq(local_details_with_swift) }
1113
1003
  end
1114
1004
  end
@@ -1123,19 +1013,16 @@ describe Ibandit::LocalDetailsCleaner do
1123
1013
 
1124
1014
  context "without a bank code" do
1125
1015
  let(:bank_code) { nil }
1126
-
1127
1016
  it { is_expected.to eq(local_details_with_swift) }
1128
1017
  end
1129
1018
 
1130
1019
  context "without a branch code" do
1131
1020
  let(:branch_code) { nil }
1132
-
1133
1021
  it { is_expected.to eq(local_details_with_swift) }
1134
1022
  end
1135
1023
 
1136
1024
  context "without an account number" do
1137
1025
  let(:account_number) { nil }
1138
-
1139
1026
  it { is_expected.to eq(local_details_with_swift) }
1140
1027
  end
1141
1028
  end
@@ -1149,13 +1036,11 @@ describe Ibandit::LocalDetailsCleaner do
1149
1036
 
1150
1037
  context "without an account number" do
1151
1038
  let(:account_number) { nil }
1152
-
1153
1039
  it { is_expected.to eq(local_details_with_swift) }
1154
1040
  end
1155
1041
 
1156
1042
  context "without a bank code" do
1157
1043
  let(:bank_code) { nil }
1158
-
1159
1044
  it { is_expected.to eq(local_details_with_swift) }
1160
1045
  end
1161
1046
  end
@@ -1172,7 +1057,6 @@ describe Ibandit::LocalDetailsCleaner do
1172
1057
 
1173
1058
  context "without an account number" do
1174
1059
  let(:account_number) { nil }
1175
-
1176
1060
  it { is_expected.to eq(local_details_with_swift) }
1177
1061
  end
1178
1062
 
@@ -1196,19 +1080,16 @@ describe Ibandit::LocalDetailsCleaner do
1196
1080
 
1197
1081
  context "with an account number which needs zero-padding" do
1198
1082
  let(:account_number) { "123438" }
1199
-
1200
1083
  its([:account_number]) { is_expected.to eq("0000123438") }
1201
1084
  end
1202
1085
 
1203
1086
  context "without a bank code" do
1204
1087
  let(:bank_code) { nil }
1205
-
1206
1088
  it { is_expected.to eq(local_details_with_swift) }
1207
1089
  end
1208
1090
 
1209
1091
  context "without an account number" do
1210
1092
  let(:account_number) { nil }
1211
-
1212
1093
  it { is_expected.to eq(local_details_with_swift) }
1213
1094
  end
1214
1095
  end
@@ -1223,27 +1104,23 @@ describe Ibandit::LocalDetailsCleaner do
1223
1104
  context "with an account number prefix" do
1224
1105
  let(:prefix) { "000019" }
1225
1106
  let(:account_number) { "8742637541" }
1226
-
1227
1107
  before { local_details.merge!(account_number_prefix: prefix) }
1228
1108
 
1229
1109
  its([:account_number]) { is_expected.to eq("0000198742637541") }
1230
1110
 
1231
1111
  context "which needs zero-padding" do
1232
1112
  let(:prefix) { "19" }
1233
-
1234
1113
  its([:account_number]) { is_expected.to eq("0000198742637541") }
1235
1114
  end
1236
1115
  end
1237
1116
 
1238
1117
  context "without a bank code" do
1239
1118
  let(:bank_code) { nil }
1240
-
1241
1119
  it { is_expected.to eq(local_details_with_swift) }
1242
1120
  end
1243
1121
 
1244
1122
  context "without an account number" do
1245
1123
  let(:account_number) { nil }
1246
-
1247
1124
  it { is_expected.to eq(local_details_with_swift) }
1248
1125
  end
1249
1126
  end
@@ -1258,31 +1135,26 @@ describe Ibandit::LocalDetailsCleaner do
1258
1135
 
1259
1136
  context "with an explicit check digit" do
1260
1137
  before { local_details.merge!(check_digit: "Y") }
1261
-
1262
1138
  it { is_expected.to eq(local_details_with_swift) }
1263
1139
  end
1264
1140
 
1265
1141
  context "with the account number not zero-padded" do
1266
1142
  let(:account_number) { "123456" }
1267
-
1268
1143
  its([:account_number]) { is_expected.to eq("000000123456") }
1269
1144
  end
1270
1145
 
1271
1146
  context "without a bank code" do
1272
1147
  let(:bank_code) { nil }
1273
-
1274
1148
  it { is_expected.to eq(local_details_with_swift) }
1275
1149
  end
1276
1150
 
1277
1151
  context "without a branch code" do
1278
1152
  let(:branch_code) { nil }
1279
-
1280
1153
  it { is_expected.to eq(local_details_with_swift) }
1281
1154
  end
1282
1155
 
1283
1156
  context "without an account number" do
1284
1157
  let(:account_number) { nil }
1285
-
1286
1158
  it { is_expected.to eq(local_details_with_swift) }
1287
1159
  end
1288
1160
  end