ibandit 0.11.28 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.rubocop.yml +2 -5
- data/.rubocop_todo.yml +70 -15
- data/.travis.yml +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile +1 -3
- data/README.md +6 -6
- data/data/structures.yml +4 -4
- data/ibandit.gemspec +2 -2
- data/lib/ibandit.rb +6 -3
- data/lib/ibandit/check_digit.rb +2 -0
- data/lib/ibandit/constants.rb +3 -1
- data/lib/ibandit/errors.rb +2 -0
- data/lib/ibandit/german_details_converter.rb +4 -1
- data/lib/ibandit/iban.rb +8 -4
- data/lib/ibandit/iban_assembler.rb +2 -0
- data/lib/ibandit/iban_splitter.rb +8 -7
- data/lib/ibandit/local_details_cleaner.rb +38 -35
- data/lib/ibandit/pseudo_iban_assembler.rb +5 -1
- data/lib/ibandit/pseudo_iban_splitter.rb +7 -1
- data/lib/ibandit/sweden/bank_lookup.rb +2 -0
- data/lib/ibandit/sweden/local_details_converter.rb +6 -2
- data/lib/ibandit/sweden/validator.rb +2 -0
- data/lib/ibandit/version.rb +3 -1
- data/spec/ibandit/constants_spec.rb +2 -0
- data/spec/ibandit/german_details_converter_spec.rb +9 -3
- data/spec/ibandit/iban_assembler_spec.rb +92 -3
- data/spec/ibandit/iban_spec.rb +197 -17
- data/spec/ibandit/iban_splitter_spec.rb +6 -0
- data/spec/ibandit/local_details_cleaner_spec.rb +135 -5
- data/spec/ibandit/pseudo_iban_assembler_spec.rb +2 -0
- data/spec/ibandit/pseudo_iban_splitter_spec.rb +2 -0
- data/spec/ibandit/structure_spec.rb +5 -3
- data/spec/ibandit/sweden/local_details_converter_spec.rb +3 -0
- data/spec/ibandit/sweden/validator_spec.rb +35 -0
- data/spec/spec_helper.rb +2 -0
- metadata +5 -6
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Ibandit
|
2
4
|
class PseudoIBANAssembler
|
3
5
|
def initialize(country_code: nil,
|
@@ -53,7 +55,8 @@ module Ibandit
|
|
53
55
|
|
54
56
|
def param_valid?(value, length_key)
|
55
57
|
return true unless value.nil?
|
56
|
-
return true if structure[length_key]
|
58
|
+
return true if structure[length_key]&.zero?
|
59
|
+
|
57
60
|
false
|
58
61
|
end
|
59
62
|
|
@@ -71,6 +74,7 @@ module Ibandit
|
|
71
74
|
|
72
75
|
def pad(number, length_key)
|
73
76
|
return if number.nil?
|
77
|
+
|
74
78
|
number.rjust(structure[length_key], padding_character)
|
75
79
|
end
|
76
80
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Ibandit
|
2
4
|
class PseudoIBANSplitter
|
3
5
|
def initialize(pseudo_iban)
|
@@ -26,16 +28,19 @@ module Ibandit
|
|
26
28
|
|
27
29
|
def bank_code
|
28
30
|
return unless country_code_valid?
|
31
|
+
|
29
32
|
pseudo_iban_part(bank_code_start_index, :pseudo_iban_bank_code_length)
|
30
33
|
end
|
31
34
|
|
32
35
|
def branch_code
|
33
36
|
return unless country_code_valid?
|
37
|
+
|
34
38
|
pseudo_iban_part(branch_code_start_index, :pseudo_iban_branch_code_length)
|
35
39
|
end
|
36
40
|
|
37
41
|
def account_number
|
38
42
|
return unless country_code_valid?
|
43
|
+
|
39
44
|
remove_leading_padding(
|
40
45
|
@pseudo_iban.slice(account_number_start_index, @pseudo_iban.length),
|
41
46
|
)
|
@@ -43,7 +48,7 @@ module Ibandit
|
|
43
48
|
|
44
49
|
def pseudo_iban_part(start_index, length_key)
|
45
50
|
length = structure.fetch(length_key)
|
46
|
-
return if length
|
51
|
+
return if length&.zero?
|
47
52
|
|
48
53
|
remove_leading_padding(@pseudo_iban.slice(start_index, length))
|
49
54
|
end
|
@@ -74,6 +79,7 @@ module Ibandit
|
|
74
79
|
|
75
80
|
def remove_leading_padding(input)
|
76
81
|
return unless padding_character
|
82
|
+
|
77
83
|
input.gsub(/\A#{padding_character}+/, "")
|
78
84
|
end
|
79
85
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Ibandit
|
2
4
|
module Sweden
|
3
5
|
class LocalDetailsConverter
|
@@ -44,6 +46,7 @@ module Ibandit
|
|
44
46
|
|
45
47
|
def remove_bad_chars(number)
|
46
48
|
return if number.nil?
|
49
|
+
|
47
50
|
number.gsub(/[-.\s]/, "")
|
48
51
|
end
|
49
52
|
|
@@ -76,7 +79,8 @@ module Ibandit
|
|
76
79
|
end
|
77
80
|
|
78
81
|
return serial_number unless bank_info.fetch(:zerofill_serial_number)
|
79
|
-
|
82
|
+
|
83
|
+
serial_number&.rjust(serial_number_length, "0")
|
80
84
|
end
|
81
85
|
|
82
86
|
def swift_account_number
|
@@ -84,7 +88,7 @@ module Ibandit
|
|
84
88
|
clearing_code && serial_number
|
85
89
|
(clearing_code + serial_number).rjust(17, "0")
|
86
90
|
else
|
87
|
-
serial_number
|
91
|
+
serial_number&.rjust(17, "0")
|
88
92
|
end
|
89
93
|
end
|
90
94
|
end
|
data/lib/ibandit/version.rb
CHANGED
@@ -1,15 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
|
3
5
|
describe Ibandit::GermanDetailsConverter do
|
4
6
|
shared_examples "json based fixture" do |json_fixture_file|
|
5
7
|
json_fixture(json_fixture_file).each do |convertor|
|
6
8
|
context "Rule #{convertor['convertor']}" do
|
9
|
+
subject { test_subject }
|
10
|
+
|
7
11
|
let(:klass) do
|
8
12
|
described_class.const_get("Rule#{convertor['convertor']}")
|
9
13
|
end
|
10
14
|
|
11
|
-
subject { test_subject }
|
12
|
-
|
13
15
|
before do
|
14
16
|
expect_any_instance_of(klass).to receive(:converted_details).
|
15
17
|
and_call_original
|
@@ -30,8 +32,9 @@ describe Ibandit::GermanDetailsConverter do
|
|
30
32
|
let(:converted_account_number) do
|
31
33
|
tuple["converted_account_number"] || account_number
|
32
34
|
end
|
35
|
+
|
33
36
|
it do
|
34
|
-
|
37
|
+
expect(subject).to eq(
|
35
38
|
bank_code: converted_bank_code,
|
36
39
|
account_number: converted_account_number,
|
37
40
|
)
|
@@ -44,6 +47,7 @@ describe Ibandit::GermanDetailsConverter do
|
|
44
47
|
"#{tuple['account_number']}" do
|
45
48
|
let(:bank_code) { tuple["bank_code"] || "00000000" }
|
46
49
|
let(:account_number) { tuple["account_number"] }
|
50
|
+
|
47
51
|
it "raises UnsupportedAccountDetails" do
|
48
52
|
expect { subject }.
|
49
53
|
to raise_error(Ibandit::UnsupportedAccountDetails)
|
@@ -88,6 +92,7 @@ describe Ibandit::GermanDetailsConverter do
|
|
88
92
|
valid_account_numbers.each do |number|
|
89
93
|
context number.to_s do
|
90
94
|
let(:account_number) { number }
|
95
|
+
|
91
96
|
it { is_expected.to be_valid }
|
92
97
|
end
|
93
98
|
end
|
@@ -95,6 +100,7 @@ describe Ibandit::GermanDetailsConverter do
|
|
95
100
|
invalid_account_numbers.each do |number|
|
96
101
|
context number.to_s do
|
97
102
|
let(:account_number) { number }
|
103
|
+
|
98
104
|
it { is_expected.to_not be_valid }
|
99
105
|
end
|
100
106
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "spec_helper"
|
2
4
|
|
3
5
|
describe Ibandit::IBANAssembler do
|
@@ -5,10 +7,10 @@ describe Ibandit::IBANAssembler do
|
|
5
7
|
let(:iban) { Ibandit::IBAN.new(iban_code) }
|
6
8
|
let(:args) do
|
7
9
|
{
|
8
|
-
country_code:
|
10
|
+
country_code: iban.country_code,
|
9
11
|
account_number: iban.swift_account_number,
|
10
|
-
branch_code:
|
11
|
-
bank_code:
|
12
|
+
branch_code: iban.swift_branch_code,
|
13
|
+
bank_code: iban.swift_bank_code,
|
12
14
|
}.reject { |_key, value| value.nil? }
|
13
15
|
end
|
14
16
|
|
@@ -19,15 +21,18 @@ describe Ibandit::IBANAssembler do
|
|
19
21
|
|
20
22
|
describe ".assemble" do
|
21
23
|
subject(:assemble) { described_class.assemble(args) }
|
24
|
+
|
22
25
|
let(:args) { { country_code: "ES" } }
|
23
26
|
|
24
27
|
context "without a country_code" do
|
25
28
|
let(:args) { { bank_code: 1 } }
|
29
|
+
|
26
30
|
it { is_expected.to be_nil }
|
27
31
|
end
|
28
32
|
|
29
33
|
context "with an unsupported country_code" do
|
30
34
|
let(:args) { { country_code: "FU" } }
|
35
|
+
|
31
36
|
it { is_expected.to be_nil }
|
32
37
|
end
|
33
38
|
|
@@ -46,11 +51,13 @@ describe Ibandit::IBANAssembler do
|
|
46
51
|
|
47
52
|
context "without an account_number" do
|
48
53
|
before { args.delete(:account_number) }
|
54
|
+
|
49
55
|
it { is_expected.to be_nil }
|
50
56
|
end
|
51
57
|
|
52
58
|
context "without an bank_code" do
|
53
59
|
before { args.delete(:bank_code) }
|
60
|
+
|
54
61
|
it { is_expected.to be_nil }
|
55
62
|
end
|
56
63
|
end
|
@@ -64,6 +71,7 @@ describe Ibandit::IBANAssembler do
|
|
64
71
|
|
65
72
|
context "without an account_number" do
|
66
73
|
before { args.delete(:account_number) }
|
74
|
+
|
67
75
|
it { is_expected.to be_nil }
|
68
76
|
end
|
69
77
|
end
|
@@ -84,11 +92,13 @@ describe Ibandit::IBANAssembler do
|
|
84
92
|
|
85
93
|
context "without an account_number" do
|
86
94
|
before { args.delete(:account_number) }
|
95
|
+
|
87
96
|
it { is_expected.to be_nil }
|
88
97
|
end
|
89
98
|
|
90
99
|
context "without a bank_code" do
|
91
100
|
before { args.delete(:bank_code) }
|
101
|
+
|
92
102
|
it { is_expected.to be_nil }
|
93
103
|
end
|
94
104
|
end
|
@@ -109,16 +119,19 @@ describe Ibandit::IBANAssembler do
|
|
109
119
|
|
110
120
|
context "without an branch_code" do
|
111
121
|
before { args.delete(:branch_code) }
|
122
|
+
|
112
123
|
it { is_expected.to eq("CY040020000001200527600") }
|
113
124
|
end
|
114
125
|
|
115
126
|
context "without an account_number" do
|
116
127
|
before { args.delete(:account_number) }
|
128
|
+
|
117
129
|
it { is_expected.to be_nil }
|
118
130
|
end
|
119
131
|
|
120
132
|
context "without an bank_code" do
|
121
133
|
before { args.delete(:bank_code) }
|
134
|
+
|
122
135
|
it { is_expected.to be_nil }
|
123
136
|
end
|
124
137
|
end
|
@@ -138,11 +151,13 @@ describe Ibandit::IBANAssembler do
|
|
138
151
|
|
139
152
|
context "without a bank_code" do
|
140
153
|
before { args.delete(:bank_code) }
|
154
|
+
|
141
155
|
it { is_expected.to be_nil }
|
142
156
|
end
|
143
157
|
|
144
158
|
context "without an account_number" do
|
145
159
|
before { args.delete(:account_number) }
|
160
|
+
|
146
161
|
it { is_expected.to be_nil }
|
147
162
|
end
|
148
163
|
end
|
@@ -160,11 +175,13 @@ describe Ibandit::IBANAssembler do
|
|
160
175
|
|
161
176
|
context "without a bank_code" do
|
162
177
|
before { args.delete(:bank_code) }
|
178
|
+
|
163
179
|
it { is_expected.to be_nil }
|
164
180
|
end
|
165
181
|
|
166
182
|
context "without an account_number" do
|
167
183
|
before { args.delete(:account_number) }
|
184
|
+
|
168
185
|
it { is_expected.to be_nil }
|
169
186
|
end
|
170
187
|
end
|
@@ -182,11 +199,13 @@ describe Ibandit::IBANAssembler do
|
|
182
199
|
|
183
200
|
context "without a bank_code" do
|
184
201
|
before { args.delete(:bank_code) }
|
202
|
+
|
185
203
|
it { is_expected.to be_nil }
|
186
204
|
end
|
187
205
|
|
188
206
|
context "without an account_number" do
|
189
207
|
before { args.delete(:account_number) }
|
208
|
+
|
190
209
|
it { is_expected.to be_nil }
|
191
210
|
end
|
192
211
|
end
|
@@ -206,6 +225,7 @@ describe Ibandit::IBANAssembler do
|
|
206
225
|
|
207
226
|
context "without an account_number" do
|
208
227
|
before { args.delete(:account_number) }
|
228
|
+
|
209
229
|
it { is_expected.to be_nil }
|
210
230
|
end
|
211
231
|
end
|
@@ -226,7 +246,9 @@ describe Ibandit::IBANAssembler do
|
|
226
246
|
|
227
247
|
context "without a bank_code or branch code" do
|
228
248
|
before { args.delete(:bank_code) }
|
249
|
+
|
229
250
|
before { args.delete(:branch_code) }
|
251
|
+
|
230
252
|
before { args[:account_number] = "23100001180000012345" }
|
231
253
|
|
232
254
|
it { is_expected.to be_nil }
|
@@ -234,6 +256,7 @@ describe Ibandit::IBANAssembler do
|
|
234
256
|
|
235
257
|
context "without an account_number" do
|
236
258
|
before { args.delete(:account_number) }
|
259
|
+
|
237
260
|
it { is_expected.to be_nil }
|
238
261
|
end
|
239
262
|
end
|
@@ -249,11 +272,13 @@ describe Ibandit::IBANAssembler do
|
|
249
272
|
|
250
273
|
context "without an account_number" do
|
251
274
|
before { args.delete(:account_number) }
|
275
|
+
|
252
276
|
it { is_expected.to be_nil }
|
253
277
|
end
|
254
278
|
|
255
279
|
context "without a bank_code" do
|
256
280
|
before { args.delete(:bank_code) }
|
281
|
+
|
257
282
|
it { is_expected.to be_nil }
|
258
283
|
end
|
259
284
|
end
|
@@ -274,21 +299,25 @@ describe Ibandit::IBANAssembler do
|
|
274
299
|
|
275
300
|
context "without the rib key in the account number" do
|
276
301
|
before { args[:account_number] = "0500013M026" }
|
302
|
+
|
277
303
|
specify { expect(Ibandit::IBAN.new(assemble)).to_not be_valid }
|
278
304
|
end
|
279
305
|
|
280
306
|
context "without a bank_code" do
|
281
307
|
before { args.delete(:bank_code) }
|
308
|
+
|
282
309
|
it { is_expected.to be_nil }
|
283
310
|
end
|
284
311
|
|
285
312
|
context "without a branch_code" do
|
286
313
|
before { args.delete(:branch_code) }
|
314
|
+
|
287
315
|
it { is_expected.to be_nil }
|
288
316
|
end
|
289
317
|
|
290
318
|
context "without an account_number" do
|
291
319
|
before { args.delete(:account_number) }
|
320
|
+
|
292
321
|
it { is_expected.to be_nil }
|
293
322
|
end
|
294
323
|
end
|
@@ -309,26 +338,31 @@ describe Ibandit::IBANAssembler do
|
|
309
338
|
|
310
339
|
context "with the bank_code supplied manually" do
|
311
340
|
before { args.merge!(bank_code: "BARC") }
|
341
|
+
|
312
342
|
it { is_expected.to eq("GB07BARC20000000579135") }
|
313
343
|
end
|
314
344
|
|
315
345
|
context "without a branch_code" do
|
316
346
|
before { args.delete(:branch_code) }
|
347
|
+
|
317
348
|
it { is_expected.to be_nil }
|
318
349
|
end
|
319
350
|
|
320
351
|
context "without an account_number" do
|
321
352
|
before { args.delete(:account_number) }
|
353
|
+
|
322
354
|
it { is_expected.to be_nil }
|
323
355
|
end
|
324
356
|
|
325
357
|
context "without a bank_code" do
|
326
358
|
before { args.delete(:bank_code) }
|
359
|
+
|
327
360
|
it { is_expected.to be_nil }
|
328
361
|
end
|
329
362
|
|
330
363
|
context "with a non-numeric branch code" do
|
331
364
|
before { args[:branch_code] = "abc123" }
|
365
|
+
|
332
366
|
it { is_expected.to be_nil }
|
333
367
|
end
|
334
368
|
end
|
@@ -349,16 +383,19 @@ describe Ibandit::IBANAssembler do
|
|
349
383
|
|
350
384
|
context "without an account_number" do
|
351
385
|
before { args.delete(:account_number) }
|
386
|
+
|
352
387
|
it { is_expected.to be_nil }
|
353
388
|
end
|
354
389
|
|
355
390
|
context "without a bank_code" do
|
356
391
|
before { args.delete(:bank_code) }
|
392
|
+
|
357
393
|
it { is_expected.to be_nil }
|
358
394
|
end
|
359
395
|
|
360
396
|
context "without a branch_code" do
|
361
397
|
before { args.delete(:branch_code) }
|
398
|
+
|
362
399
|
it { is_expected.to be_nil }
|
363
400
|
end
|
364
401
|
end
|
@@ -376,11 +413,13 @@ describe Ibandit::IBANAssembler do
|
|
376
413
|
|
377
414
|
context "without a bank_code" do
|
378
415
|
before { args.delete(:bank_code) }
|
416
|
+
|
379
417
|
it { is_expected.to be_nil }
|
380
418
|
end
|
381
419
|
|
382
420
|
context "without an account_number" do
|
383
421
|
before { args.delete(:account_number) }
|
422
|
+
|
384
423
|
it { is_expected.to be_nil }
|
385
424
|
end
|
386
425
|
end
|
@@ -401,7 +440,9 @@ describe Ibandit::IBANAssembler do
|
|
401
440
|
|
402
441
|
context "without a bank_code or branch_code" do
|
403
442
|
before { args.delete(:bank_code) }
|
443
|
+
|
404
444
|
before { args.delete(:branch_code) }
|
445
|
+
|
405
446
|
before { args[:account_number] = "11773016-11111018-00000000" }
|
406
447
|
|
407
448
|
it { is_expected.to be_nil }
|
@@ -409,6 +450,7 @@ describe Ibandit::IBANAssembler do
|
|
409
450
|
|
410
451
|
context "without a bank_code" do
|
411
452
|
before { args.delete(:bank_code) }
|
453
|
+
|
412
454
|
before { args[:account_number] = "11773016-11111018-00000000" }
|
413
455
|
|
414
456
|
it { is_expected.to be_nil }
|
@@ -416,6 +458,7 @@ describe Ibandit::IBANAssembler do
|
|
416
458
|
|
417
459
|
context "without a branch_code" do
|
418
460
|
before { args.delete(:branch_code) }
|
461
|
+
|
419
462
|
before { args[:account_number] = "11773016-11111018-00000000" }
|
420
463
|
|
421
464
|
it { is_expected.to be_nil }
|
@@ -423,6 +466,7 @@ describe Ibandit::IBANAssembler do
|
|
423
466
|
|
424
467
|
context "without an account_number" do
|
425
468
|
before { args.delete(:account_number) }
|
469
|
+
|
426
470
|
it { is_expected.to be_nil }
|
427
471
|
end
|
428
472
|
end
|
@@ -441,16 +485,19 @@ describe Ibandit::IBANAssembler do
|
|
441
485
|
|
442
486
|
context "without a branch_code" do
|
443
487
|
before { args.delete(:branch_code) }
|
488
|
+
|
444
489
|
it { is_expected.to be_nil }
|
445
490
|
end
|
446
491
|
|
447
492
|
context "without an account_number" do
|
448
493
|
before { args.delete(:account_number) }
|
494
|
+
|
449
495
|
it { is_expected.to be_nil }
|
450
496
|
end
|
451
497
|
|
452
498
|
context "without a bank_code" do
|
453
499
|
before { args.delete(:bank_code) }
|
500
|
+
|
454
501
|
it { is_expected.to be_nil }
|
455
502
|
end
|
456
503
|
end
|
@@ -470,11 +517,13 @@ describe Ibandit::IBANAssembler do
|
|
470
517
|
|
471
518
|
context "without an account_number" do
|
472
519
|
before { args.delete(:account_number) }
|
520
|
+
|
473
521
|
it { is_expected.to be_nil }
|
474
522
|
end
|
475
523
|
|
476
524
|
context "without a bank_code" do
|
477
525
|
before { args.delete(:bank_code) }
|
526
|
+
|
478
527
|
it { is_expected.to be_nil }
|
479
528
|
end
|
480
529
|
end
|
@@ -495,31 +544,37 @@ describe Ibandit::IBANAssembler do
|
|
495
544
|
|
496
545
|
context "with an explicitly passed check digit" do
|
497
546
|
before { args[:check_digit] = "Y" }
|
547
|
+
|
498
548
|
it { is_expected.to eq("IT64Y0542811101000000123456") }
|
499
549
|
end
|
500
550
|
|
501
551
|
context "with a bad character in an odd position" do
|
502
552
|
before { args[:account_number] = "000000123h00" }
|
553
|
+
|
503
554
|
it { is_expected.to be_nil }
|
504
555
|
end
|
505
556
|
|
506
557
|
context "with a bad character in an even position" do
|
507
558
|
before { args[:account_number] = "0000001230h0" }
|
559
|
+
|
508
560
|
it { is_expected.to be_nil }
|
509
561
|
end
|
510
562
|
|
511
563
|
context "without a bank_code" do
|
512
564
|
before { args.delete(:bank_code) }
|
565
|
+
|
513
566
|
it { is_expected.to be_nil }
|
514
567
|
end
|
515
568
|
|
516
569
|
context "without a branch_code" do
|
517
570
|
before { args.delete(:branch_code) }
|
571
|
+
|
518
572
|
it { is_expected.to be_nil }
|
519
573
|
end
|
520
574
|
|
521
575
|
context "without an account_number" do
|
522
576
|
before { args.delete(:account_number) }
|
577
|
+
|
523
578
|
it { is_expected.to be_nil }
|
524
579
|
end
|
525
580
|
end
|
@@ -539,11 +594,13 @@ describe Ibandit::IBANAssembler do
|
|
539
594
|
|
540
595
|
context "without an account_number" do
|
541
596
|
before { args.delete(:account_number) }
|
597
|
+
|
542
598
|
it { is_expected.to be_nil }
|
543
599
|
end
|
544
600
|
|
545
601
|
context "without a bank_code" do
|
546
602
|
before { args.delete(:bank_code) }
|
603
|
+
|
547
604
|
it { is_expected.to be_nil }
|
548
605
|
end
|
549
606
|
end
|
@@ -563,11 +620,13 @@ describe Ibandit::IBANAssembler do
|
|
563
620
|
|
564
621
|
context "without an account_number" do
|
565
622
|
before { args.delete(:account_number) }
|
623
|
+
|
566
624
|
it { is_expected.to be_nil }
|
567
625
|
end
|
568
626
|
|
569
627
|
context "without a bank_code" do
|
570
628
|
before { args.delete(:bank_code) }
|
629
|
+
|
571
630
|
it { is_expected.to be_nil }
|
572
631
|
end
|
573
632
|
end
|
@@ -587,11 +646,13 @@ describe Ibandit::IBANAssembler do
|
|
587
646
|
|
588
647
|
context "without an account_number" do
|
589
648
|
before { args.delete(:account_number) }
|
649
|
+
|
590
650
|
it { is_expected.to be_nil }
|
591
651
|
end
|
592
652
|
|
593
653
|
context "without a bank_code" do
|
594
654
|
before { args.delete(:bank_code) }
|
655
|
+
|
595
656
|
it { is_expected.to be_nil }
|
596
657
|
end
|
597
658
|
end
|
@@ -612,21 +673,25 @@ describe Ibandit::IBANAssembler do
|
|
612
673
|
|
613
674
|
context "without the rib key in the account number" do
|
614
675
|
before { args[:account_number] = "0500013M026" }
|
676
|
+
|
615
677
|
specify { expect(Ibandit::IBAN.new(assemble)).to_not be_valid }
|
616
678
|
end
|
617
679
|
|
618
680
|
context "without a bank_code" do
|
619
681
|
before { args.delete(:bank_code) }
|
682
|
+
|
620
683
|
it { is_expected.to be_nil }
|
621
684
|
end
|
622
685
|
|
623
686
|
context "without a branch_code" do
|
624
687
|
before { args.delete(:branch_code) }
|
688
|
+
|
625
689
|
it { is_expected.to be_nil }
|
626
690
|
end
|
627
691
|
|
628
692
|
context "without an account_number" do
|
629
693
|
before { args.delete(:account_number) }
|
694
|
+
|
630
695
|
it { is_expected.to be_nil }
|
631
696
|
end
|
632
697
|
end
|
@@ -650,21 +715,25 @@ describe Ibandit::IBANAssembler do
|
|
650
715
|
|
651
716
|
context "without a branch_code" do
|
652
717
|
before { args.delete(:branch_code) }
|
718
|
+
|
653
719
|
it { is_expected.to be_nil }
|
654
720
|
end
|
655
721
|
|
656
722
|
context "without an account_number" do
|
657
723
|
before { args.delete(:account_number) }
|
724
|
+
|
658
725
|
it { is_expected.to be_nil }
|
659
726
|
end
|
660
727
|
|
661
728
|
context "without a bank_code" do
|
662
729
|
before { args.delete(:bank_code) }
|
730
|
+
|
663
731
|
it { is_expected.to be_nil }
|
664
732
|
end
|
665
733
|
|
666
734
|
context "with a non-numeric branch code" do
|
667
735
|
before { args[:branch_code] = "abc123" }
|
736
|
+
|
668
737
|
it { is_expected.to be_nil }
|
669
738
|
end
|
670
739
|
end
|
@@ -684,11 +753,13 @@ describe Ibandit::IBANAssembler do
|
|
684
753
|
|
685
754
|
context "without an account_number" do
|
686
755
|
before { args.delete(:account_number) }
|
756
|
+
|
687
757
|
it { is_expected.to be_nil }
|
688
758
|
end
|
689
759
|
|
690
760
|
context "without an bank_code" do
|
691
761
|
before { args.delete(:bank_code) }
|
762
|
+
|
692
763
|
it { is_expected.to be_nil }
|
693
764
|
end
|
694
765
|
end
|
@@ -708,6 +779,7 @@ describe Ibandit::IBANAssembler do
|
|
708
779
|
|
709
780
|
context "without a bank_code" do
|
710
781
|
before { args.delete(:bank_code) }
|
782
|
+
|
711
783
|
before { args[:account_number] = "86011117947" }
|
712
784
|
|
713
785
|
it { is_expected.to be_nil }
|
@@ -715,6 +787,7 @@ describe Ibandit::IBANAssembler do
|
|
715
787
|
|
716
788
|
context "without an account_number" do
|
717
789
|
before { args.delete(:account_number) }
|
790
|
+
|
718
791
|
it { is_expected.to be_nil }
|
719
792
|
end
|
720
793
|
end
|
@@ -734,6 +807,7 @@ describe Ibandit::IBANAssembler do
|
|
734
807
|
|
735
808
|
context "without a bank_code" do
|
736
809
|
before { args.delete(:bank_code) }
|
810
|
+
|
737
811
|
before { args[:account_number] = "60102010260000042270201111" }
|
738
812
|
|
739
813
|
it { is_expected.to be_nil }
|
@@ -741,6 +815,7 @@ describe Ibandit::IBANAssembler do
|
|
741
815
|
|
742
816
|
context "without an account_number" do
|
743
817
|
before { args.delete(:account_number) }
|
818
|
+
|
744
819
|
it { is_expected.to be_nil }
|
745
820
|
end
|
746
821
|
end
|
@@ -761,16 +836,19 @@ describe Ibandit::IBANAssembler do
|
|
761
836
|
|
762
837
|
context "without a bank_code" do
|
763
838
|
before { args.delete(:bank_code) }
|
839
|
+
|
764
840
|
it { is_expected.to be_nil }
|
765
841
|
end
|
766
842
|
|
767
843
|
context "without a branch_code" do
|
768
844
|
before { args.delete(:branch_code) }
|
845
|
+
|
769
846
|
it { is_expected.to be_nil }
|
770
847
|
end
|
771
848
|
|
772
849
|
context "without an account_number" do
|
773
850
|
before { args.delete(:account_number) }
|
851
|
+
|
774
852
|
it { is_expected.to be_nil }
|
775
853
|
end
|
776
854
|
end
|
@@ -790,11 +868,13 @@ describe Ibandit::IBANAssembler do
|
|
790
868
|
|
791
869
|
context "without an account_number" do
|
792
870
|
before { args.delete(:account_number) }
|
871
|
+
|
793
872
|
it { is_expected.to be_nil }
|
794
873
|
end
|
795
874
|
|
796
875
|
context "without a bank_code" do
|
797
876
|
before { args.delete(:bank_code) }
|
877
|
+
|
798
878
|
it { is_expected.to be_nil }
|
799
879
|
end
|
800
880
|
end
|
@@ -814,11 +894,13 @@ describe Ibandit::IBANAssembler do
|
|
814
894
|
|
815
895
|
context "without a bank_code" do
|
816
896
|
before { args.delete(:bank_code) }
|
897
|
+
|
817
898
|
it { is_expected.to be_nil }
|
818
899
|
end
|
819
900
|
|
820
901
|
context "without an account_number" do
|
821
902
|
before { args.delete(:account_number) }
|
903
|
+
|
822
904
|
it { is_expected.to be_nil }
|
823
905
|
end
|
824
906
|
end
|
@@ -838,11 +920,13 @@ describe Ibandit::IBANAssembler do
|
|
838
920
|
|
839
921
|
context "without a bank_code" do
|
840
922
|
before { args.delete(:bank_code) }
|
923
|
+
|
841
924
|
it { is_expected.to be_nil }
|
842
925
|
end
|
843
926
|
|
844
927
|
context "without an account_number" do
|
845
928
|
before { args.delete(:account_number) }
|
929
|
+
|
846
930
|
it { is_expected.to be_nil }
|
847
931
|
end
|
848
932
|
end
|
@@ -862,11 +946,13 @@ describe Ibandit::IBANAssembler do
|
|
862
946
|
|
863
947
|
context "without a bank_code" do
|
864
948
|
before { args.delete(:bank_code) }
|
949
|
+
|
865
950
|
it { is_expected.to be_nil }
|
866
951
|
end
|
867
952
|
|
868
953
|
context "without an account_number" do
|
869
954
|
before { args.delete(:account_number) }
|
955
|
+
|
870
956
|
it { is_expected.to be_nil }
|
871
957
|
end
|
872
958
|
end
|
@@ -887,16 +973,19 @@ describe Ibandit::IBANAssembler do
|
|
887
973
|
|
888
974
|
context "without a bank_code" do
|
889
975
|
before { args.delete(:bank_code) }
|
976
|
+
|
890
977
|
it { is_expected.to be_nil }
|
891
978
|
end
|
892
979
|
|
893
980
|
context "without a branch_code" do
|
894
981
|
before { args.delete(:branch_code) }
|
982
|
+
|
895
983
|
it { is_expected.to be_nil }
|
896
984
|
end
|
897
985
|
|
898
986
|
context "without an account_number" do
|
899
987
|
before { args.delete(:account_number) }
|
988
|
+
|
900
989
|
it { is_expected.to be_nil }
|
901
990
|
end
|
902
991
|
end
|