ibandit 0.11.6 → 0.11.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,18 +1,18 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe Ibandit::IBANSplitter do
4
4
  subject(:split) { described_class.split(iban_code) }
5
5
 
6
- context 'with a valid IBAN' do
7
- let(:iban_code) { 'GB82WEST12345698765432' }
8
- its([:country_code]) { is_expected.to eq('GB') }
9
- its([:check_digits]) { is_expected.to eq('82') }
10
- its([:bank_code]) { is_expected.to eq('WEST') }
11
- its([:branch_code]) { is_expected.to eq('123456') }
12
- its([:account_number]) { is_expected.to eq('98765432') }
6
+ context "with a valid IBAN" do
7
+ let(:iban_code) { "GB82WEST12345698765432" }
8
+ its([:country_code]) { is_expected.to eq("GB") }
9
+ its([:check_digits]) { is_expected.to eq("82") }
10
+ its([:bank_code]) { is_expected.to eq("WEST") }
11
+ its([:branch_code]) { is_expected.to eq("123456") }
12
+ its([:account_number]) { is_expected.to eq("98765432") }
13
13
  end
14
14
 
15
- context 'with nil' do
15
+ context "with nil" do
16
16
  let(:iban_code) { nil }
17
17
  its([:country_code]) { is_expected.to eq(nil) }
18
18
  its([:check_digits]) { is_expected.to eq(nil) }
@@ -21,8 +21,8 @@ describe Ibandit::IBANSplitter do
21
21
  its([:account_number]) { is_expected.to eq(nil) }
22
22
  end
23
23
 
24
- context 'with an empty string' do
25
- let(:iban_code) { '' }
24
+ context "with an empty string" do
25
+ let(:iban_code) { "" }
26
26
  its([:country_code]) { is_expected.to eq(nil) }
27
27
  its([:check_digits]) { is_expected.to eq(nil) }
28
28
  its([:bank_code]) { is_expected.to eq(nil) }
@@ -30,9 +30,9 @@ describe Ibandit::IBANSplitter do
30
30
  its([:account_number]) { is_expected.to eq(nil) }
31
31
  end
32
32
 
33
- context 'with an invalid length IBAN' do
34
- let(:iban_code) { 'MC9320052222100112233M445' }
35
- its([:country_code]) { is_expected.to eq('MC') }
33
+ context "with an invalid length IBAN" do
34
+ let(:iban_code) { "MC9320052222100112233M445" }
35
+ its([:country_code]) { is_expected.to eq("MC") }
36
36
  its([:check_digits]) { is_expected.to eq(nil) }
37
37
  its([:bank_code]) { is_expected.to eq(nil) }
38
38
  its([:branch_code]) { is_expected.to eq(nil) }
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe Ibandit::LocalDetailsCleaner do
4
4
  subject(:cleaned) { described_class.clean(local_details) }
@@ -7,7 +7,7 @@ describe Ibandit::LocalDetailsCleaner do
7
7
  country_code: country_code,
8
8
  bank_code: bank_code,
9
9
  branch_code: branch_code,
10
- account_number: account_number
10
+ account_number: account_number,
11
11
  }
12
12
  end
13
13
 
@@ -15,7 +15,7 @@ describe Ibandit::LocalDetailsCleaner do
15
15
  local_details.merge(
16
16
  swift_bank_code: bank_code,
17
17
  swift_branch_code: branch_code,
18
- swift_account_number: account_number
18
+ swift_account_number: account_number,
19
19
  )
20
20
  end
21
21
 
@@ -24,1066 +24,1087 @@ describe Ibandit::LocalDetailsCleaner do
24
24
  let(:branch_code) { nil }
25
25
  let(:account_number) { nil }
26
26
 
27
- context 'without country code' do
27
+ context "without country code" do
28
28
  it { is_expected.to eq(local_details_with_swift) }
29
29
  end
30
30
 
31
- context 'with an unsupported country code' do
32
- let(:country_code) { 'FU' }
31
+ context "with an unsupported country code" do
32
+ let(:country_code) { "FU" }
33
33
  it { is_expected.to eq(local_details_with_swift) }
34
34
  end
35
35
 
36
- context 'Austria' do
37
- let(:country_code) { 'AT' }
38
- let(:bank_code) { '19043' }
39
- let(:account_number) { '00234573201' }
36
+ context "Austria" do
37
+ let(:country_code) { "AT" }
38
+ let(:bank_code) { "19043" }
39
+ let(:account_number) { "00234573201" }
40
40
 
41
41
  it { is_expected.to eq(local_details_with_swift) }
42
42
 
43
- context 'with an account number which needs zero-padding' do
44
- let(:account_number) { '234573201' }
45
- its([:account_number]) { is_expected.to eq('00234573201') }
43
+ context "with an account number which needs zero-padding" do
44
+ let(:account_number) { "234573201" }
45
+ its([:account_number]) { is_expected.to eq("00234573201") }
46
46
  end
47
47
 
48
- context 'with an account number under 4 digits' do
49
- let(:account_number) { '123' }
50
- its([:account_number]) { is_expected.to eq('123') }
48
+ context "with an account number under 4 digits" do
49
+ let(:account_number) { "123" }
50
+ its([:account_number]) { is_expected.to eq("123") }
51
51
  end
52
52
 
53
- context 'with a long account number' do
54
- let(:account_number) { '234573201999' }
53
+ context "with a long account number" do
54
+ let(:account_number) { "234573201999" }
55
55
  it { is_expected.to eq(local_details_with_swift) }
56
56
  end
57
57
 
58
- context 'without an account number' do
58
+ context "without an account number" do
59
59
  let(:account_number) { nil }
60
60
  it { is_expected.to eq(local_details_with_swift) }
61
61
  end
62
62
 
63
- context 'with a short bank code' do
64
- let(:bank_code) { '1904' }
63
+ context "with a short bank code" do
64
+ let(:bank_code) { "1904" }
65
65
  it { is_expected.to eq(local_details_with_swift) }
66
66
  end
67
67
 
68
- context 'with a long bank code' do
69
- let(:bank_code) { '190430' }
68
+ context "with a long bank code" do
69
+ let(:bank_code) { "190430" }
70
70
  it { is_expected.to eq(local_details_with_swift) }
71
71
  end
72
72
 
73
- context 'without a bank code' do
73
+ context "without a bank code" do
74
74
  let(:bank_code) { nil }
75
75
  it { is_expected.to eq(local_details_with_swift) }
76
76
  end
77
77
  end
78
78
 
79
- context 'Belgium' do
80
- let(:country_code) { 'BE' }
81
- let(:account_number) { '510007547061' }
79
+ context "Australia" do
80
+ let(:country_code) { "AU" }
81
+ let(:account_number) { "123456789" }
82
+
83
+ context "with dashes" do
84
+ let(:branch_code) { "123-456" }
85
+
86
+ its([:country_code]) { is_expected.to eq(country_code) }
87
+ its([:account_number]) { is_expected.to eq(account_number) }
88
+ its([:branch_code]) { is_expected.to eq("123456") }
89
+ end
90
+
91
+ context "without dashes" do
92
+ let(:branch_code) { "123456" }
93
+
94
+ its([:country_code]) { is_expected.to eq(country_code) }
95
+ its([:account_number]) { is_expected.to eq(account_number) }
96
+ its([:branch_code]) { is_expected.to eq("123456") }
97
+ end
98
+ end
99
+
100
+ context "Belgium" do
101
+ let(:country_code) { "BE" }
102
+ let(:account_number) { "510007547061" }
82
103
 
83
104
  its([:country_code]) { is_expected.to eq(country_code) }
84
105
  its([:account_number]) { is_expected.to eq(account_number) }
85
- its([:bank_code]) { is_expected.to eq('510') }
106
+ its([:bank_code]) { is_expected.to eq("510") }
86
107
 
87
- context 'with dashes' do
88
- let(:account_number) { '510-0075470-61' }
89
- its([:bank_code]) { is_expected.to eq('510') }
90
- its([:account_number]) { is_expected.to eq('510007547061') }
108
+ context "with dashes" do
109
+ let(:account_number) { "510-0075470-61" }
110
+ its([:bank_code]) { is_expected.to eq("510") }
111
+ its([:account_number]) { is_expected.to eq("510007547061") }
91
112
  end
92
113
 
93
- context 'without an account number' do
114
+ context "without an account number" do
94
115
  let(:account_number) { nil }
95
116
  it { is_expected.to eq(local_details_with_swift) }
96
117
  end
97
118
  end
98
119
 
99
- context 'Bulgaria' do
100
- let(:country_code) { 'BG' }
101
- let(:bank_code) { 'BNBG' }
102
- let(:branch_code) { '9661' }
103
- let(:account_number) { '1020345678' }
120
+ context "Bulgaria" do
121
+ let(:country_code) { "BG" }
122
+ let(:bank_code) { "BNBG" }
123
+ let(:branch_code) { "9661" }
124
+ let(:account_number) { "1020345678" }
104
125
 
105
126
  it { is_expected.to eq(local_details_with_swift) }
106
127
 
107
- context 'without an account number' do
128
+ context "without an account number" do
108
129
  let(:account_number) { nil }
109
130
  it { is_expected.to eq(local_details_with_swift) }
110
131
  end
111
132
 
112
- context 'without a branch code' do
133
+ context "without a branch code" do
113
134
  let(:branch_code) { nil }
114
135
  it { is_expected.to eq(local_details_with_swift) }
115
136
  end
116
137
 
117
- context 'without a bank code' do
138
+ context "without a bank code" do
118
139
  let(:bank_code) { nil }
119
140
  it { is_expected.to eq(local_details_with_swift) }
120
141
  end
121
142
  end
122
143
 
123
- context 'Cyprus' do
124
- let(:country_code) { 'CY' }
125
- let(:account_number) { '0000001200527600' }
126
- let(:bank_code) { '002' }
127
- let(:branch_code) { '00128' }
144
+ context "Cyprus" do
145
+ let(:country_code) { "CY" }
146
+ let(:account_number) { "0000001200527600" }
147
+ let(:bank_code) { "002" }
148
+ let(:branch_code) { "00128" }
128
149
 
129
150
  it { is_expected.to eq(local_details_with_swift) }
130
151
 
131
- context 'with a short account number' do
132
- let(:account_number) { '1200527600' }
133
- its([:account_number]) { is_expected.to eq('0000001200527600') }
152
+ context "with a short account number" do
153
+ let(:account_number) { "1200527600" }
154
+ its([:account_number]) { is_expected.to eq("0000001200527600") }
134
155
  end
135
156
 
136
- context 'with a too-short account number' do
137
- let(:account_number) { '123456' }
157
+ context "with a too-short account number" do
158
+ let(:account_number) { "123456" }
138
159
  its([:account_number]) { is_expected.to eq(account_number) }
139
160
  end
140
161
 
141
- context 'with a long account number' do
142
- let(:account_number) { '00000001200527600' }
162
+ context "with a long account number" do
163
+ let(:account_number) { "00000001200527600" }
143
164
  it { is_expected.to eq(local_details_with_swift) }
144
165
  end
145
166
 
146
- context 'without an account number' do
167
+ context "without an account number" do
147
168
  let(:account_number) { nil }
148
169
  it { is_expected.to eq(local_details_with_swift) }
149
170
  end
150
171
 
151
- context 'with the branch code in the bank code field' do
152
- let(:bank_code) { '002 00128' }
172
+ context "with the branch code in the bank code field" do
173
+ let(:bank_code) { "002 00128" }
153
174
  let(:branch_code) { nil }
154
- its([:bank_code]) { is_expected.to eq('002') }
155
- its([:branch_code]) { is_expected.to eq('00128') }
175
+ its([:bank_code]) { is_expected.to eq("002") }
176
+ its([:branch_code]) { is_expected.to eq("00128") }
156
177
  end
157
178
 
158
- context 'without a bank code' do
179
+ context "without a bank code" do
159
180
  let(:bank_code) { nil }
160
181
  it { is_expected.to eq(local_details_with_swift) }
161
182
  end
162
183
  end
163
184
 
164
- context 'Czech Republic' do
165
- let(:country_code) { 'CZ' }
166
- let(:bank_code) { '0800' }
167
- let(:account_number) { '0000192000145399' }
185
+ context "Czech Republic" do
186
+ let(:country_code) { "CZ" }
187
+ let(:bank_code) { "0800" }
188
+ let(:account_number) { "0000192000145399" }
168
189
 
169
190
  it { is_expected.to eq(local_details_with_swift) }
170
191
 
171
- context 'with an account number prefix' do
172
- let(:prefix) { '000019' }
173
- let(:account_number) { '2000145399' }
192
+ context "with an account number prefix" do
193
+ let(:prefix) { "000019" }
194
+ let(:account_number) { "2000145399" }
174
195
  before { local_details.merge!(account_number_prefix: prefix) }
175
196
 
176
- its([:account_number]) { is_expected.to eq('0000192000145399') }
197
+ its([:account_number]) { is_expected.to eq("0000192000145399") }
177
198
 
178
- context 'which needs zero-padding' do
179
- let(:prefix) { '19' }
180
- its([:account_number]) { is_expected.to eq('0000192000145399') }
199
+ context "which needs zero-padding" do
200
+ let(:prefix) { "19" }
201
+ its([:account_number]) { is_expected.to eq("0000192000145399") }
181
202
  end
182
203
  end
183
204
 
184
- context 'without a bank code' do
205
+ context "without a bank code" do
185
206
  let(:bank_code) { nil }
186
207
  it { is_expected.to eq(local_details_with_swift) }
187
208
  end
188
209
 
189
- context 'without an account number' do
210
+ context "without an account number" do
190
211
  let(:account_number) { nil }
191
212
  it { is_expected.to eq(local_details_with_swift) }
192
213
  end
193
214
  end
194
215
 
195
- context 'Germany' do
196
- let(:country_code) { 'DE' }
197
- let(:bank_code) { '37040044' }
198
- let(:account_number) { '0532013000' }
216
+ context "Germany" do
217
+ let(:country_code) { "DE" }
218
+ let(:bank_code) { "37040044" }
219
+ let(:account_number) { "0532013000" }
199
220
 
200
221
  it { is_expected.to eq(local_details_with_swift) }
201
222
 
202
- context 'without a bank code' do
223
+ context "without a bank code" do
203
224
  let(:bank_code) { nil }
204
225
  it { is_expected.to eq(local_details_with_swift) }
205
226
  end
206
227
 
207
- context 'without an account number' do
228
+ context "without an account number" do
208
229
  let(:account_number) { nil }
209
230
  it { is_expected.to eq(local_details_with_swift) }
210
231
  end
211
232
 
212
- context 'with an excessively short account number' do
213
- let(:account_number) { '666' }
233
+ context "with an excessively short account number" do
234
+ let(:account_number) { "666" }
214
235
  its([:account_number]) { is_expected.to eq(account_number) }
215
236
  end
216
237
 
217
- context 'with a pseudo account number' do
218
- let(:bank_code) { '37080040' }
219
- let(:account_number) { '111' }
238
+ context "with a pseudo account number" do
239
+ let(:bank_code) { "37080040" }
240
+ let(:account_number) { "111" }
220
241
  its([:bank_code]) { is_expected.to eq(bank_code) }
221
- its([:account_number]) { is_expected.to eq('0215022000') }
242
+ its([:account_number]) { is_expected.to eq("0215022000") }
222
243
  end
223
244
 
224
- context 'with unsupported account details' do
225
- let(:account_number) { '7955791111' }
226
- let(:bank_code) { '20000000' }
245
+ context "with unsupported account details" do
246
+ let(:account_number) { "7955791111" }
247
+ let(:bank_code) { "20000000" }
227
248
  it { is_expected.to eq(local_details_with_swift) }
228
249
  end
229
250
  end
230
251
 
231
- context 'Denmark' do
232
- let(:country_code) { 'DK' }
233
- let(:bank_code) { '40' }
234
- let(:account_number) { '440116243' }
252
+ context "Denmark" do
253
+ let(:country_code) { "DK" }
254
+ let(:bank_code) { "40" }
255
+ let(:account_number) { "440116243" }
235
256
 
236
- its([:bank_code]) { is_expected.to eq('0040') }
237
- its([:account_number]) { is_expected.to eq('0440116243') }
257
+ its([:bank_code]) { is_expected.to eq("0040") }
258
+ its([:account_number]) { is_expected.to eq("0440116243") }
238
259
 
239
- context 'with bank and branch codes in the account number' do
260
+ context "with bank and branch codes in the account number" do
240
261
  let(:bank_code) { nil }
241
262
  let(:branch_code) { nil }
242
- let(:account_number) { '345-317-9681' }
263
+ let(:account_number) { "345-317-9681" }
243
264
 
244
- its([:bank_code]) { is_expected.to eq('0345') }
245
- its([:account_number]) { is_expected.to eq('0003179681') }
265
+ its([:bank_code]) { is_expected.to eq("0345") }
266
+ its([:account_number]) { is_expected.to eq("0003179681") }
246
267
  end
247
268
 
248
- context 'with a space-separated 14-digit account number' do
269
+ context "with a space-separated 14-digit account number" do
249
270
  let(:bank_code) { nil }
250
271
  let(:branch_code) { nil }
251
- let(:account_number) { '0345 0003179681' }
272
+ let(:account_number) { "0345 0003179681" }
252
273
 
253
- its([:bank_code]) { is_expected.to eq('0345') }
254
- its([:account_number]) { is_expected.to eq('0003179681') }
274
+ its([:bank_code]) { is_expected.to eq("0345") }
275
+ its([:account_number]) { is_expected.to eq("0003179681") }
255
276
  end
256
277
 
257
- context 'with a space-separated 13-digit account number' do
278
+ context "with a space-separated 13-digit account number" do
258
279
  let(:bank_code) { nil }
259
280
  let(:branch_code) { nil }
260
- let(:account_number) { '0345 003179681' }
281
+ let(:account_number) { "0345 003179681" }
261
282
 
262
283
  it { is_expected.to eq(local_details_with_swift) }
263
284
  end
264
285
 
265
- context 'without an account number' do
286
+ context "without an account number" do
266
287
  let(:account_number) { nil }
267
288
  it { is_expected.to eq(local_details_with_swift) }
268
289
  end
269
290
  end
270
291
 
271
- context 'Estonia' do
272
- let(:country_code) { 'EE' }
273
- let(:account_number) { '0221020145685' }
292
+ context "Estonia" do
293
+ let(:country_code) { "EE" }
294
+ let(:account_number) { "0221020145685" }
274
295
 
275
- its([:bank_code]) { is_expected.to eq('22') }
276
- its([:account_number]) { is_expected.to eq('00221020145685') }
296
+ its([:bank_code]) { is_expected.to eq("22") }
297
+ its([:account_number]) { is_expected.to eq("00221020145685") }
277
298
 
278
- context 'with an account number that needs translating' do
279
- let(:account_number) { '111020145685' }
280
- its([:bank_code]) { is_expected.to eq('22') }
281
- its([:account_number]) { is_expected.to eq('00111020145685') }
299
+ context "with an account number that needs translating" do
300
+ let(:account_number) { "111020145685" }
301
+ its([:bank_code]) { is_expected.to eq("22") }
302
+ its([:account_number]) { is_expected.to eq("00111020145685") }
282
303
  end
283
304
 
284
- context 'without an account number' do
305
+ context "without an account number" do
285
306
  let(:account_number) { nil }
286
307
  it { is_expected.to eq(local_details_with_swift) }
287
308
  end
288
309
  end
289
310
 
290
- context 'Spain' do
291
- let(:country_code) { 'ES' }
292
- let(:bank_code) { '2310' }
293
- let(:branch_code) { '0001' }
294
- let(:account_number) { '180000012345' }
311
+ context "Spain" do
312
+ let(:country_code) { "ES" }
313
+ let(:bank_code) { "2310" }
314
+ let(:branch_code) { "0001" }
315
+ let(:account_number) { "180000012345" }
295
316
 
296
317
  it { is_expected.to eq(local_details_with_swift) }
297
318
 
298
- context 'with bank and branch codes in the account number' do
319
+ context "with bank and branch codes in the account number" do
299
320
  let(:bank_code) { nil }
300
321
  let(:branch_code) { nil }
301
- let(:account_number) { '2310-0001-18-0000012345' }
322
+ let(:account_number) { "2310-0001-18-0000012345" }
302
323
 
303
- its([:bank_code]) { is_expected.to eq('2310') }
304
- its([:branch_code]) { is_expected.to eq('0001') }
305
- its([:account_number]) { is_expected.to eq('180000012345') }
324
+ its([:bank_code]) { is_expected.to eq("2310") }
325
+ its([:branch_code]) { is_expected.to eq("0001") }
326
+ its([:account_number]) { is_expected.to eq("180000012345") }
306
327
  end
307
328
 
308
- context 'with spaces in the account number' do
309
- let(:account_number) { '18 0000012345' }
310
- its([:account_number]) { is_expected.to eq('180000012345') }
329
+ context "with spaces in the account number" do
330
+ let(:account_number) { "18 0000012345" }
331
+ its([:account_number]) { is_expected.to eq("180000012345") }
311
332
  end
312
333
 
313
- context 'without an account number' do
334
+ context "without an account number" do
314
335
  let(:account_number) { nil }
315
336
  it { is_expected.to eq(local_details_with_swift) }
316
337
  end
317
338
  end
318
339
 
319
- context 'Finland' do
320
- let(:country_code) { 'FI' }
321
- let(:bank_code) { '123456' }
322
- let(:account_number) { '00000785' }
340
+ context "Finland" do
341
+ let(:country_code) { "FI" }
342
+ let(:bank_code) { "123456" }
343
+ let(:account_number) { "00000785" }
323
344
 
324
345
  it { is_expected.to eq(local_details_with_swift) }
325
346
 
326
- context 'with a shorter account number' do
327
- let(:account_number) { '785' }
328
- its([:account_number]) { is_expected.to eq('00000785') }
347
+ context "with a shorter account number" do
348
+ let(:account_number) { "785" }
349
+ its([:account_number]) { is_expected.to eq("00000785") }
329
350
  end
330
351
 
331
- context 'with a savings bank account_number in traditional format' do
332
- let(:account_number) { '78510' }
333
- let(:bank_code) { '423456' }
352
+ context "with a savings bank account_number in traditional format" do
353
+ let(:account_number) { "78510" }
354
+ let(:bank_code) { "423456" }
334
355
 
335
356
  its([:bank_code]) { is_expected.to eq(bank_code) }
336
- its([:account_number]) { is_expected.to eq('70008510') }
357
+ its([:account_number]) { is_expected.to eq("70008510") }
337
358
  end
338
359
 
339
- context 'without an account number' do
360
+ context "without an account number" do
340
361
  let(:account_number) { nil }
341
362
  it { is_expected.to eq(local_details_with_swift) }
342
363
  end
343
364
 
344
- context 'without a bank code' do
365
+ context "without a bank code" do
345
366
  let(:bank_code) { nil }
346
367
  it { is_expected.to eq(local_details_with_swift) }
347
368
  end
348
369
  end
349
370
 
350
- context 'France' do
351
- let(:country_code) { 'FR' }
352
- let(:bank_code) { '20041' }
353
- let(:branch_code) { '01005' }
354
- let(:account_number) { '0500013M02606' }
371
+ context "France" do
372
+ let(:country_code) { "FR" }
373
+ let(:bank_code) { "20041" }
374
+ let(:branch_code) { "01005" }
375
+ let(:account_number) { "0500013M02606" }
355
376
 
356
377
  it { is_expected.to eq(local_details_with_swift) }
357
378
 
358
- context 'with the RIB key spaced in the account number' do
359
- let(:account_number) { '0500013M026 06' }
360
- its([:account_number]) { is_expected.to eq('0500013M02606') }
379
+ context "with the RIB key spaced in the account number" do
380
+ let(:account_number) { "0500013M026 06" }
381
+ its([:account_number]) { is_expected.to eq("0500013M02606") }
361
382
  end
362
383
 
363
- context 'with the RIB key hyphenated in the account number' do
364
- let(:account_number) { '0500013M026-06' }
365
- its([:account_number]) { is_expected.to eq('0500013M02606') }
384
+ context "with the RIB key hyphenated in the account number" do
385
+ let(:account_number) { "0500013M026-06" }
386
+ its([:account_number]) { is_expected.to eq("0500013M02606") }
366
387
  end
367
388
 
368
- context 'with the RIB key missing' do
369
- let(:account_number) { '0500013M026' }
389
+ context "with the RIB key missing" do
390
+ let(:account_number) { "0500013M026" }
370
391
  it { is_expected.to eq(local_details_with_swift) }
371
392
  end
372
393
 
373
- context 'without a bank code' do
394
+ context "without a bank code" do
374
395
  let(:bank_code) { nil }
375
396
  it { is_expected.to eq(local_details_with_swift) }
376
397
  end
377
398
 
378
- context 'without a branch code' do
399
+ context "without a branch code" do
379
400
  let(:branch_code) { nil }
380
401
  it { is_expected.to eq(local_details_with_swift) }
381
402
  end
382
403
 
383
- context 'without an account number' do
404
+ context "without an account number" do
384
405
  let(:account_number) { nil }
385
406
  it { is_expected.to eq(local_details_with_swift) }
386
407
  end
387
408
  end
388
409
 
389
- context 'United Kingdom' do
390
- let(:country_code) { 'GB' }
391
- let(:bank_code) { 'BARC' }
392
- let(:branch_code) { '200000' }
393
- let(:account_number) { '55779911' }
410
+ context "United Kingdom" do
411
+ let(:country_code) { "GB" }
412
+ let(:bank_code) { "BARC" }
413
+ let(:branch_code) { "200000" }
414
+ let(:account_number) { "55779911" }
394
415
 
395
416
  it { is_expected.to eq(local_details_with_swift) }
396
417
 
397
- context 'with the sort code is hyphenated' do
398
- let(:branch_code) { '20-00-00' }
399
- its([:branch_code]) { is_expected.to eq('200000') }
400
- its([:swift_branch_code]) { is_expected.to eq('200000') }
418
+ context "with the sort code is hyphenated" do
419
+ let(:branch_code) { "20-00-00" }
420
+ its([:branch_code]) { is_expected.to eq("200000") }
421
+ its([:swift_branch_code]) { is_expected.to eq("200000") }
401
422
  end
402
423
 
403
- context 'with the sort code spaced' do
404
- let(:branch_code) { '20 00 00' }
405
- its([:branch_code]) { is_expected.to eq('200000') }
424
+ context "with the sort code spaced" do
425
+ let(:branch_code) { "20 00 00" }
426
+ its([:branch_code]) { is_expected.to eq("200000") }
406
427
  end
407
428
 
408
- context 'with a short account number' do
409
- let(:account_number) { '579135' }
410
- its([:account_number]) { is_expected.to eq('00579135') }
411
- its([:swift_account_number]) { is_expected.to eq('00579135') }
429
+ context "with a short account number" do
430
+ let(:account_number) { "579135" }
431
+ its([:account_number]) { is_expected.to eq("00579135") }
432
+ its([:swift_account_number]) { is_expected.to eq("00579135") }
412
433
  end
413
434
 
414
- context 'with a too-short account number' do
415
- let(:account_number) { '5678' }
435
+ context "with a too-short account number" do
436
+ let(:account_number) { "5678" }
416
437
  its([:account_number]) { is_expected.to eq(account_number) }
417
438
  end
418
439
 
419
- context 'with the account number spaced' do
420
- let(:account_number) { '5577 9911' }
421
- its([:account_number]) { is_expected.to eq('55779911') }
440
+ context "with the account number spaced" do
441
+ let(:account_number) { "5577 9911" }
442
+ its([:account_number]) { is_expected.to eq("55779911") }
422
443
  end
423
444
 
424
- context 'with the account number hyphenated' do
425
- let(:account_number) { '5577-9911' }
426
- its([:account_number]) { is_expected.to eq('55779911') }
445
+ context "with the account number hyphenated" do
446
+ let(:account_number) { "5577-9911" }
447
+ its([:account_number]) { is_expected.to eq("55779911") }
427
448
  end
428
449
 
429
- context 'without a branch code' do
450
+ context "without a branch code" do
430
451
  let(:branch_code) { nil }
431
452
  it { is_expected.to eq(local_details_with_swift) }
432
453
  end
433
454
 
434
- context 'without a bank code' do
455
+ context "without a bank code" do
435
456
  let(:bank_code) { nil }
436
457
  it { is_expected.to eq(local_details_with_swift) }
437
458
 
438
- context 'with a BIC finder set' do
459
+ context "with a BIC finder set" do
439
460
  let(:bic_finder) { double }
440
461
  before do
441
- allow(bic_finder).to receive(:call).with('GB', '200000').
442
- and_return('BARCGB22XXX')
462
+ allow(bic_finder).to receive(:call).with("GB", "200000").
463
+ and_return("BARCGB22XXX")
443
464
  Ibandit.bic_finder = bic_finder
444
465
  end
445
466
  after { Ibandit.bic_finder = nil }
446
467
 
447
- its([:bank_code]) { is_expected.to eq('BARC') }
448
- its([:swift_bank_code]) { is_expected.to eq('BARC') }
468
+ its([:bank_code]) { is_expected.to eq("BARC") }
469
+ its([:swift_bank_code]) { is_expected.to eq("BARC") }
449
470
  end
450
471
  end
451
472
 
452
- context 'with a bank code and BIC finder set' do
453
- let(:bank_code) { 'OVERRIDE' }
473
+ context "with a bank code and BIC finder set" do
474
+ let(:bank_code) { "OVERRIDE" }
454
475
  let(:bic_finder) { double }
455
476
  before do
456
- allow(bic_finder).to receive(:call).with('GB', '200000').
457
- and_return('BARCGB22XXX')
477
+ allow(bic_finder).to receive(:call).with("GB", "200000").
478
+ and_return("BARCGB22XXX")
458
479
  Ibandit.bic_finder = bic_finder
459
480
  end
460
481
  after { Ibandit.bic_finder = nil }
461
482
 
462
- its([:bank_code]) { is_expected.to eq('OVERRIDE') }
483
+ its([:bank_code]) { is_expected.to eq("OVERRIDE") }
463
484
  end
464
485
  end
465
486
 
466
- context 'Greece' do
467
- let(:country_code) { 'GR' }
468
- let(:bank_code) { '011' }
469
- let(:branch_code) { '0125' }
470
- let(:account_number) { '0000000012300695' }
487
+ context "Greece" do
488
+ let(:country_code) { "GR" }
489
+ let(:bank_code) { "011" }
490
+ let(:branch_code) { "0125" }
491
+ let(:account_number) { "0000000012300695" }
471
492
 
472
493
  it { is_expected.to eq(local_details_with_swift) }
473
494
 
474
- context 'without an account number' do
495
+ context "without an account number" do
475
496
  let(:account_number) { nil }
476
497
  it { is_expected.to eq(local_details_with_swift) }
477
498
  end
478
499
 
479
- context 'without a bank code' do
500
+ context "without a bank code" do
480
501
  let(:bank_code) { nil }
481
502
  it { is_expected.to eq(local_details_with_swift) }
482
503
  end
483
504
 
484
- context 'without a branch code' do
505
+ context "without a branch code" do
485
506
  let(:branch_code) { nil }
486
507
  it { is_expected.to eq(local_details_with_swift) }
487
508
  end
488
509
  end
489
510
 
490
- context 'Croatia' do
491
- let(:country_code) { 'HR' }
492
- let(:bank_code) { '1001005' }
493
- let(:account_number) { '1863000160' }
511
+ context "Croatia" do
512
+ let(:country_code) { "HR" }
513
+ let(:bank_code) { "1001005" }
514
+ let(:account_number) { "1863000160" }
494
515
 
495
516
  it { is_expected.to eq(local_details_with_swift) }
496
517
 
497
- context 'with bank code in the account number' do
518
+ context "with bank code in the account number" do
498
519
  let(:bank_code) { nil }
499
520
  let(:branch_code) { nil }
500
- let(:account_number) { '1001005-1863000160' }
521
+ let(:account_number) { "1001005-1863000160" }
501
522
 
502
- its([:bank_code]) { is_expected.to eq('1001005') }
503
- its([:account_number]) { is_expected.to eq('1863000160') }
523
+ its([:bank_code]) { is_expected.to eq("1001005") }
524
+ its([:account_number]) { is_expected.to eq("1863000160") }
504
525
 
505
- context 'with a badly formatted account number' do
506
- let(:account_number) { '1863000160' }
526
+ context "with a badly formatted account number" do
527
+ let(:account_number) { "1863000160" }
507
528
  it { is_expected.to eq(local_details_with_swift) }
508
529
  end
509
530
  end
510
531
 
511
- context 'without an account number' do
532
+ context "without an account number" do
512
533
  let(:account_number) { nil }
513
534
  it { is_expected.to eq(local_details_with_swift) }
514
535
  end
515
536
  end
516
537
 
517
- context 'Hungary' do
518
- let(:country_code) { 'HU' }
519
- let(:bank_code) { '117' }
520
- let(:branch_code) { '7301' }
521
- let(:account_number) { '61111101800000000' }
538
+ context "Hungary" do
539
+ let(:country_code) { "HU" }
540
+ let(:bank_code) { "117" }
541
+ let(:branch_code) { "7301" }
542
+ let(:account_number) { "61111101800000000" }
522
543
 
523
544
  it { is_expected.to eq(local_details_with_swift) }
524
545
 
525
- context 'with bank and branch codes in the account number' do
546
+ context "with bank and branch codes in the account number" do
526
547
  let(:bank_code) { nil }
527
548
  let(:branch_code) { nil }
528
549
 
529
- context 'with a full account number' do
530
- let(:account_number) { '11773016-11111018-00000000' }
550
+ context "with a full account number" do
551
+ let(:account_number) { "11773016-11111018-00000000" }
531
552
 
532
- its([:bank_code]) { is_expected.to eq('117') }
533
- its([:branch_code]) { is_expected.to eq('7301') }
534
- its([:account_number]) { is_expected.to eq('61111101800000000') }
553
+ its([:bank_code]) { is_expected.to eq("117") }
554
+ its([:branch_code]) { is_expected.to eq("7301") }
555
+ its([:account_number]) { is_expected.to eq("61111101800000000") }
535
556
  end
536
557
 
537
- context 'with a short account number' do
538
- let(:account_number) { '11773016-11111018' }
558
+ context "with a short account number" do
559
+ let(:account_number) { "11773016-11111018" }
539
560
 
540
- its([:bank_code]) { is_expected.to eq('117') }
541
- its([:branch_code]) { is_expected.to eq('7301') }
542
- its([:account_number]) { is_expected.to eq('61111101800000000') }
561
+ its([:bank_code]) { is_expected.to eq("117") }
562
+ its([:branch_code]) { is_expected.to eq("7301") }
563
+ its([:account_number]) { is_expected.to eq("61111101800000000") }
543
564
  end
544
565
 
545
- context 'with an invalid length account number' do
546
- let(:account_number) { '11773016-1111101' }
566
+ context "with an invalid length account number" do
567
+ let(:account_number) { "11773016-1111101" }
547
568
  it { is_expected.to eq(local_details_with_swift) }
548
569
  end
549
570
 
550
- context 'with a bank code, too' do
551
- let(:account_number) { '11773016-11111018' }
552
- let(:bank_code) { '117' }
571
+ context "with a bank code, too" do
572
+ let(:account_number) { "11773016-11111018" }
573
+ let(:bank_code) { "117" }
553
574
  it { is_expected.to eq(local_details_with_swift) }
554
575
  end
555
576
  end
556
577
 
557
- context 'without an account number' do
578
+ context "without an account number" do
558
579
  let(:account_number) { nil }
559
580
  it { is_expected.to eq(local_details_with_swift) }
560
581
  end
561
582
  end
562
583
 
563
- context 'Ireland' do
564
- let(:country_code) { 'IE' }
565
- let(:bank_code) { 'AIBK' }
566
- let(:branch_code) { '931152' }
567
- let(:account_number) { '12345678' }
584
+ context "Ireland" do
585
+ let(:country_code) { "IE" }
586
+ let(:bank_code) { "AIBK" }
587
+ let(:branch_code) { "931152" }
588
+ let(:account_number) { "12345678" }
568
589
 
569
590
  it { is_expected.to eq(local_details_with_swift) }
570
591
 
571
- context 'with the sort code is hyphenated' do
572
- let(:branch_code) { '93-11-52' }
573
- its([:branch_code]) { is_expected.to eq('931152') }
592
+ context "with the sort code is hyphenated" do
593
+ let(:branch_code) { "93-11-52" }
594
+ its([:branch_code]) { is_expected.to eq("931152") }
574
595
  end
575
596
 
576
- context 'with the sort code spaced' do
577
- let(:branch_code) { '93 11 52' }
578
- its([:branch_code]) { is_expected.to eq('931152') }
597
+ context "with the sort code spaced" do
598
+ let(:branch_code) { "93 11 52" }
599
+ its([:branch_code]) { is_expected.to eq("931152") }
579
600
  end
580
601
 
581
- context 'with a short account number' do
582
- let(:account_number) { '579135' }
583
- its([:account_number]) { is_expected.to eq('00579135') }
602
+ context "with a short account number" do
603
+ let(:account_number) { "579135" }
604
+ its([:account_number]) { is_expected.to eq("00579135") }
584
605
  end
585
606
 
586
- context 'with a too-short account number' do
587
- let(:account_number) { '5678' }
607
+ context "with a too-short account number" do
608
+ let(:account_number) { "5678" }
588
609
  its([:account_number]) { is_expected.to eq(account_number) }
589
610
  end
590
611
 
591
- context 'with the account number spaced' do
592
- let(:account_number) { '5577 9911' }
593
- its([:account_number]) { is_expected.to eq('55779911') }
612
+ context "with the account number spaced" do
613
+ let(:account_number) { "5577 9911" }
614
+ its([:account_number]) { is_expected.to eq("55779911") }
594
615
  end
595
616
 
596
- context 'with the account number hyphenated' do
597
- let(:account_number) { '5577-9911' }
598
- its([:account_number]) { is_expected.to eq('55779911') }
617
+ context "with the account number hyphenated" do
618
+ let(:account_number) { "5577-9911" }
619
+ its([:account_number]) { is_expected.to eq("55779911") }
599
620
  end
600
621
 
601
- context 'without a branch code' do
622
+ context "without a branch code" do
602
623
  let(:branch_code) { nil }
603
624
  it { is_expected.to eq(local_details_with_swift) }
604
625
  end
605
626
 
606
- context 'without a bank code' do
627
+ context "without a bank code" do
607
628
  let(:bank_code) { nil }
608
629
  it { is_expected.to eq(local_details_with_swift) }
609
630
 
610
- context 'with a BIC finder set' do
631
+ context "with a BIC finder set" do
611
632
  let(:bic_finder) { double }
612
633
  before do
613
- allow(bic_finder).to receive(:call).with('IE', '931152').
614
- and_return('AIBKIE22XXX')
634
+ allow(bic_finder).to receive(:call).with("IE", "931152").
635
+ and_return("AIBKIE22XXX")
615
636
  Ibandit.bic_finder = bic_finder
616
637
  end
617
638
  after { Ibandit.bic_finder = nil }
618
639
 
619
- its([:bank_code]) { is_expected.to eq('AIBK') }
640
+ its([:bank_code]) { is_expected.to eq("AIBK") }
620
641
  end
621
642
  end
622
643
 
623
- context 'with a bank code and BIC finder set' do
624
- let(:bank_code) { 'OVERRIDE' }
644
+ context "with a bank code and BIC finder set" do
645
+ let(:bank_code) { "OVERRIDE" }
625
646
  let(:bic_finder) { double }
626
647
  before do
627
- allow(bic_finder).to receive(:call).with('IE', '931152').
628
- and_return('AIBKIE22XXX')
648
+ allow(bic_finder).to receive(:call).with("IE", "931152").
649
+ and_return("AIBKIE22XXX")
629
650
  Ibandit.bic_finder = bic_finder
630
651
  end
631
652
  after { Ibandit.bic_finder = nil }
632
653
 
633
- its([:bank_code]) { is_expected.to eq('OVERRIDE') }
654
+ its([:bank_code]) { is_expected.to eq("OVERRIDE") }
634
655
  end
635
656
  end
636
657
 
637
- context 'Iceland' do
638
- let(:country_code) { 'IS' }
639
- let(:bank_code) { '311' }
640
- let(:account_number) { '26-2468-460697-2049' }
658
+ context "Iceland" do
659
+ let(:country_code) { "IS" }
660
+ let(:bank_code) { "311" }
661
+ let(:account_number) { "26-2468-460697-2049" }
641
662
 
642
- its([:bank_code]) { is_expected.to eq('0311') }
643
- its([:account_number]) { is_expected.to eq('260024684606972049') }
663
+ its([:bank_code]) { is_expected.to eq("0311") }
664
+ its([:account_number]) { is_expected.to eq("260024684606972049") }
644
665
 
645
- context 'with bank code in the account number' do
666
+ context "with bank code in the account number" do
646
667
  let(:bank_code) { nil }
647
- let(:account_number) { '311-26-2468-460697-2049' }
668
+ let(:account_number) { "311-26-2468-460697-2049" }
648
669
 
649
- its([:bank_code]) { is_expected.to eq('0311') }
650
- its([:account_number]) { is_expected.to eq('260024684606972049') }
670
+ its([:bank_code]) { is_expected.to eq("0311") }
671
+ its([:account_number]) { is_expected.to eq("260024684606972049") }
651
672
 
652
- context 'and no hyphens' do
653
- let(:account_number) { '0311260024684606972049' }
673
+ context "and no hyphens" do
674
+ let(:account_number) { "0311260024684606972049" }
654
675
 
655
- its([:bank_code]) { is_expected.to eq('0311') }
656
- its([:account_number]) { is_expected.to eq('260024684606972049') }
676
+ its([:bank_code]) { is_expected.to eq("0311") }
677
+ its([:account_number]) { is_expected.to eq("260024684606972049") }
657
678
  end
658
679
  end
659
680
 
660
- context 'with no hyphen in the kennitala' do
661
- let(:account_number) { '26-2468-4606972049' }
681
+ context "with no hyphen in the kennitala" do
682
+ let(:account_number) { "26-2468-4606972049" }
662
683
 
663
- its([:account_number]) { is_expected.to eq('260024684606972049') }
684
+ its([:account_number]) { is_expected.to eq("260024684606972049") }
664
685
  end
665
686
 
666
- context 'with a short kennitala' do
667
- let(:account_number) { '26-2468-60697-2049' }
687
+ context "with a short kennitala" do
688
+ let(:account_number) { "26-2468-60697-2049" }
668
689
 
669
- its([:account_number]) { is_expected.to eq('260024680606972049') }
690
+ its([:account_number]) { is_expected.to eq("260024680606972049") }
670
691
 
671
- context 'without a hyphen' do
672
- let(:account_number) { '26-2468-606972049' }
673
- its([:account_number]) { is_expected.to eq('260024680606972049') }
692
+ context "without a hyphen" do
693
+ let(:account_number) { "26-2468-606972049" }
694
+ its([:account_number]) { is_expected.to eq("260024680606972049") }
674
695
  end
675
696
  end
676
697
 
677
- context 'without an account number' do
698
+ context "without an account number" do
678
699
  let(:account_number) { nil }
679
700
  it { is_expected.to eq(local_details_with_swift) }
680
701
  end
681
702
  end
682
703
 
683
- context 'Italy' do
684
- let(:country_code) { 'IT' }
685
- let(:bank_code) { '05428' }
686
- let(:branch_code) { '11101' }
687
- let(:account_number) { '000000123456' }
704
+ context "Italy" do
705
+ let(:country_code) { "IT" }
706
+ let(:bank_code) { "05428" }
707
+ let(:branch_code) { "11101" }
708
+ let(:account_number) { "000000123456" }
688
709
 
689
710
  it { is_expected.to eq(local_details_with_swift) }
690
711
 
691
- context 'with an explicit check digit' do
692
- before { local_details.merge!(check_digit: 'Y') }
712
+ context "with an explicit check digit" do
713
+ before { local_details.merge!(check_digit: "Y") }
693
714
  it { is_expected.to eq(local_details_with_swift) }
694
715
  end
695
716
 
696
- context 'with the account number not zero-padded' do
697
- let(:account_number) { '123456' }
698
- its([:account_number]) { is_expected.to eq('000000123456') }
717
+ context "with the account number not zero-padded" do
718
+ let(:account_number) { "123456" }
719
+ its([:account_number]) { is_expected.to eq("000000123456") }
699
720
  end
700
721
 
701
- context 'without a bank code' do
722
+ context "without a bank code" do
702
723
  let(:bank_code) { nil }
703
724
  it { is_expected.to eq(local_details_with_swift) }
704
725
  end
705
726
 
706
- context 'without a branch code' do
727
+ context "without a branch code" do
707
728
  let(:branch_code) { nil }
708
729
  it { is_expected.to eq(local_details_with_swift) }
709
730
  end
710
731
 
711
- context 'without an account number' do
732
+ context "without an account number" do
712
733
  let(:account_number) { nil }
713
734
  it { is_expected.to eq(local_details_with_swift) }
714
735
  end
715
736
  end
716
737
 
717
- context 'Lithuania' do
718
- let(:country_code) { 'LT' }
719
- let(:bank_code) { '10000' }
720
- let(:account_number) { '11101001000' }
738
+ context "Lithuania" do
739
+ let(:country_code) { "LT" }
740
+ let(:bank_code) { "10000" }
741
+ let(:account_number) { "11101001000" }
721
742
 
722
743
  it { is_expected.to eq(local_details_with_swift) }
723
744
 
724
- context 'without an account number' do
745
+ context "without an account number" do
725
746
  let(:account_number) { nil }
726
747
  it { is_expected.to eq(local_details_with_swift) }
727
748
  end
728
749
 
729
- context 'without a bank code' do
750
+ context "without a bank code" do
730
751
  let(:bank_code) { nil }
731
752
  it { is_expected.to eq(local_details_with_swift) }
732
753
  end
733
754
  end
734
755
 
735
- context 'Luxembourg' do
736
- let(:country_code) { 'LU' }
737
- let(:bank_code) { '001' }
738
- let(:account_number) { '9400644750000' }
756
+ context "Luxembourg" do
757
+ let(:country_code) { "LU" }
758
+ let(:bank_code) { "001" }
759
+ let(:account_number) { "9400644750000" }
739
760
 
740
761
  it { is_expected.to eq(local_details_with_swift) }
741
762
 
742
- context 'without an account number' do
763
+ context "without an account number" do
743
764
  let(:account_number) { nil }
744
765
  it { is_expected.to eq(local_details_with_swift) }
745
766
  end
746
767
 
747
- context 'without a bank code' do
768
+ context "without a bank code" do
748
769
  let(:bank_code) { nil }
749
770
  it { is_expected.to eq(local_details_with_swift) }
750
771
  end
751
772
  end
752
773
 
753
- context 'Latvia' do
754
- let(:country_code) { 'LV' }
755
- let(:bank_code) { 'BANK' }
756
- let(:account_number) { '1234567890123' }
774
+ context "Latvia" do
775
+ let(:country_code) { "LV" }
776
+ let(:bank_code) { "BANK" }
777
+ let(:account_number) { "1234567890123" }
757
778
 
758
779
  it { is_expected.to eq(local_details_with_swift) }
759
780
 
760
- context 'without an account number' do
781
+ context "without an account number" do
761
782
  let(:account_number) { nil }
762
783
  it { is_expected.to eq(local_details_with_swift) }
763
784
  end
764
785
 
765
- context 'without a bank code' do
786
+ context "without a bank code" do
766
787
  let(:bank_code) { nil }
767
788
  it { is_expected.to eq(local_details_with_swift) }
768
789
  end
769
790
  end
770
791
 
771
- context 'Monaco' do
772
- let(:country_code) { 'MC' }
773
- let(:bank_code) { '20041' }
774
- let(:branch_code) { '01005' }
775
- let(:account_number) { '0500013M02606' }
792
+ context "Monaco" do
793
+ let(:country_code) { "MC" }
794
+ let(:bank_code) { "20041" }
795
+ let(:branch_code) { "01005" }
796
+ let(:account_number) { "0500013M02606" }
776
797
 
777
798
  it { is_expected.to eq(local_details_with_swift) }
778
799
 
779
- context 'with the RIB key spaced in the account number' do
780
- let(:account_number) { '0500013M026 06' }
781
- its([:account_number]) { is_expected.to eq('0500013M02606') }
800
+ context "with the RIB key spaced in the account number" do
801
+ let(:account_number) { "0500013M026 06" }
802
+ its([:account_number]) { is_expected.to eq("0500013M02606") }
782
803
  end
783
804
 
784
- context 'with the RIB key hyphenated in the account number' do
785
- let(:account_number) { '0500013M026-06' }
786
- its([:account_number]) { is_expected.to eq('0500013M02606') }
805
+ context "with the RIB key hyphenated in the account number" do
806
+ let(:account_number) { "0500013M026-06" }
807
+ its([:account_number]) { is_expected.to eq("0500013M02606") }
787
808
  end
788
809
 
789
- context 'with the RIB key missing' do
790
- let(:account_number) { '0500013M026' }
810
+ context "with the RIB key missing" do
811
+ let(:account_number) { "0500013M026" }
791
812
  it { is_expected.to eq(local_details_with_swift) }
792
813
  end
793
814
 
794
- context 'without a bank code' do
815
+ context "without a bank code" do
795
816
  let(:bank_code) { nil }
796
817
  it { is_expected.to eq(local_details_with_swift) }
797
818
  end
798
819
 
799
- context 'without a branch code' do
820
+ context "without a branch code" do
800
821
  let(:branch_code) { nil }
801
822
  it { is_expected.to eq(local_details_with_swift) }
802
823
  end
803
824
 
804
- context 'without an account number' do
825
+ context "without an account number" do
805
826
  let(:account_number) { nil }
806
827
  it { is_expected.to eq(local_details_with_swift) }
807
828
  end
808
829
  end
809
830
 
810
- context 'Malta' do
811
- let(:country_code) { 'MT' }
812
- let(:bank_code) { 'MMEB' }
813
- let(:branch_code) { '44093' }
814
- let(:account_number) { '000000009027293051' }
831
+ context "Malta" do
832
+ let(:country_code) { "MT" }
833
+ let(:bank_code) { "MMEB" }
834
+ let(:branch_code) { "44093" }
835
+ let(:account_number) { "000000009027293051" }
815
836
 
816
837
  it { is_expected.to eq(local_details_with_swift) }
817
838
 
818
- context 'with the account number spaced' do
819
- let(:account_number) { '9027 2930 51' }
820
- its([:account_number]) { is_expected.to eq('000000009027293051') }
839
+ context "with the account number spaced" do
840
+ let(:account_number) { "9027 2930 51" }
841
+ its([:account_number]) { is_expected.to eq("000000009027293051") }
821
842
  end
822
843
 
823
- context 'with the account number hyphenated' do
824
- let(:account_number) { '9027-2930-51' }
825
- its([:account_number]) { is_expected.to eq('000000009027293051') }
844
+ context "with the account number hyphenated" do
845
+ let(:account_number) { "9027-2930-51" }
846
+ its([:account_number]) { is_expected.to eq("000000009027293051") }
826
847
  end
827
848
 
828
- context 'without a branch code' do
849
+ context "without a branch code" do
829
850
  let(:branch_code) { nil }
830
851
  it { is_expected.to eq(local_details_with_swift) }
831
852
  end
832
853
 
833
- context 'without a bank code' do
854
+ context "without a bank code" do
834
855
  let(:bank_code) { nil }
835
856
  it { is_expected.to eq(local_details_with_swift) }
836
857
 
837
- context 'with a BIC finder set' do
858
+ context "with a BIC finder set" do
838
859
  let(:bic_finder) { double }
839
860
  before do
840
- allow(bic_finder).to receive(:call).with('MT', '44093').
841
- and_return('MMEBMTMTXXX')
861
+ allow(bic_finder).to receive(:call).with("MT", "44093").
862
+ and_return("MMEBMTMTXXX")
842
863
  Ibandit.bic_finder = bic_finder
843
864
  end
844
865
  after { Ibandit.bic_finder = nil }
845
866
 
846
- its([:bank_code]) { is_expected.to eq('MMEB') }
867
+ its([:bank_code]) { is_expected.to eq("MMEB") }
847
868
  end
848
869
  end
849
870
 
850
- context 'with a bank code and BIC finder set' do
851
- let(:bank_code) { 'OVERRIDE' }
871
+ context "with a bank code and BIC finder set" do
872
+ let(:bank_code) { "OVERRIDE" }
852
873
  let(:bic_finder) { double }
853
874
  before do
854
- allow(bic_finder).to receive(:call).with('MT', '44093').
855
- and_return('MMEBMTMTXXX')
875
+ allow(bic_finder).to receive(:call).with("MT", "44093").
876
+ and_return("MMEBMTMTXXX")
856
877
  Ibandit.bic_finder = bic_finder
857
878
  end
858
879
  after { Ibandit.bic_finder = nil }
859
880
 
860
- its([:bank_code]) { is_expected.to eq('OVERRIDE') }
881
+ its([:bank_code]) { is_expected.to eq("OVERRIDE") }
861
882
  end
862
883
  end
863
884
 
864
- context 'Netherlands' do
865
- let(:country_code) { 'NL' }
866
- let(:bank_code) { 'ABNA' }
867
- let(:account_number) { '0417164300' }
885
+ context "Netherlands" do
886
+ let(:country_code) { "NL" }
887
+ let(:bank_code) { "ABNA" }
888
+ let(:account_number) { "0417164300" }
868
889
 
869
890
  it { is_expected.to eq(local_details_with_swift) }
870
891
 
871
- context 'without a bank code' do
892
+ context "without a bank code" do
872
893
  let(:bank_code) { nil }
873
894
  it { is_expected.to eq(local_details_with_swift) }
874
895
  end
875
896
 
876
- context 'without a branch code' do
897
+ context "without a branch code" do
877
898
  let(:branch_code) { nil }
878
899
  it { is_expected.to eq(local_details_with_swift) }
879
900
  end
880
901
 
881
- context 'without an account number' do
902
+ context "without an account number" do
882
903
  let(:account_number) { nil }
883
904
  it { is_expected.to eq(local_details_with_swift) }
884
905
  end
885
906
 
886
- context 'with an account number that needs zero-padding' do
887
- let(:account_number) { '417164300' }
888
- its([:account_number]) { is_expected.to eq('0417164300') }
907
+ context "with an account number that needs zero-padding" do
908
+ let(:account_number) { "417164300" }
909
+ its([:account_number]) { is_expected.to eq("0417164300") }
889
910
  end
890
911
  end
891
912
 
892
- context 'Norway' do
893
- let(:country_code) { 'NO' }
894
- let(:bank_code) { '8601' }
895
- let(:account_number) { '1117947' }
913
+ context "Norway" do
914
+ let(:country_code) { "NO" }
915
+ let(:bank_code) { "8601" }
916
+ let(:account_number) { "1117947" }
896
917
 
897
918
  it { is_expected.to eq(local_details_with_swift) }
898
919
 
899
- context 'with bank and branch codes in the account number' do
920
+ context "with bank and branch codes in the account number" do
900
921
  let(:bank_code) { nil }
901
922
  let(:branch_code) { nil }
902
- let(:account_number) { '8601.1117947' }
923
+ let(:account_number) { "8601.1117947" }
903
924
 
904
- its([:bank_code]) { is_expected.to eq('8601') }
905
- its([:account_number]) { is_expected.to eq('1117947') }
925
+ its([:bank_code]) { is_expected.to eq("8601") }
926
+ its([:account_number]) { is_expected.to eq("1117947") }
906
927
  end
907
928
 
908
- context 'without an account number' do
929
+ context "without an account number" do
909
930
  let(:account_number) { nil }
910
931
  it { is_expected.to eq(local_details_with_swift) }
911
932
  end
912
933
  end
913
934
 
914
- context 'Poland' do
915
- let(:country_code) { 'PL' }
916
- let(:bank_code) { '10201026' }
917
- let(:account_number) { '0000042270201111' }
935
+ context "Poland" do
936
+ let(:country_code) { "PL" }
937
+ let(:bank_code) { "10201026" }
938
+ let(:account_number) { "0000042270201111" }
918
939
 
919
940
  it { is_expected.to eq(local_details_with_swift) }
920
941
 
921
- context 'with a full length account number' do
942
+ context "with a full length account number" do
922
943
  let(:bank_code) { nil }
923
944
  let(:branch_code) { nil }
924
- let(:account_number) { '60102010260000042270201111' }
945
+ let(:account_number) { "60102010260000042270201111" }
925
946
 
926
- its([:bank_code]) { is_expected.to eq('10201026') }
927
- its([:account_number]) { is_expected.to eq('0000042270201111') }
947
+ its([:bank_code]) { is_expected.to eq("10201026") }
948
+ its([:account_number]) { is_expected.to eq("0000042270201111") }
928
949
  end
929
950
 
930
- context 'without an account number' do
951
+ context "without an account number" do
931
952
  let(:account_number) { nil }
932
953
  it { is_expected.to eq(local_details_with_swift) }
933
954
  end
934
955
  end
935
956
 
936
- context 'Portugal' do
937
- let(:country_code) { 'PT' }
938
- let(:bank_code) { '0002' }
939
- let(:branch_code) { '0023' }
940
- let(:account_number) { '0023843000578' }
957
+ context "Portugal" do
958
+ let(:country_code) { "PT" }
959
+ let(:bank_code) { "0002" }
960
+ let(:branch_code) { "0023" }
961
+ let(:account_number) { "0023843000578" }
941
962
 
942
963
  it { is_expected.to eq(local_details_with_swift) }
943
964
 
944
- context 'without a bank code' do
965
+ context "without a bank code" do
945
966
  let(:bank_code) { nil }
946
967
  it { is_expected.to eq(local_details_with_swift) }
947
968
  end
948
969
 
949
- context 'without a branch code' do
970
+ context "without a branch code" do
950
971
  let(:branch_code) { nil }
951
972
  it { is_expected.to eq(local_details_with_swift) }
952
973
  end
953
974
 
954
- context 'without an account number' do
975
+ context "without an account number" do
955
976
  let(:account_number) { nil }
956
977
  it { is_expected.to eq(local_details_with_swift) }
957
978
  end
958
979
  end
959
980
 
960
- context 'Romania' do
961
- let(:country_code) { 'RO' }
962
- let(:bank_code) { 'AAAA' }
963
- let(:account_number) { '1B31007593840000' }
981
+ context "Romania" do
982
+ let(:country_code) { "RO" }
983
+ let(:bank_code) { "AAAA" }
984
+ let(:account_number) { "1B31007593840000" }
964
985
 
965
986
  it { is_expected.to eq(local_details_with_swift) }
966
987
 
967
- context 'without an account number' do
988
+ context "without an account number" do
968
989
  let(:account_number) { nil }
969
990
  it { is_expected.to eq(local_details_with_swift) }
970
991
  end
971
992
 
972
- context 'without a bank code' do
993
+ context "without a bank code" do
973
994
  let(:bank_code) { nil }
974
995
  it { is_expected.to eq(local_details_with_swift) }
975
996
  end
976
997
  end
977
998
 
978
- context 'Sweden' do
979
- let(:country_code) { 'SE' }
999
+ context "Sweden" do
1000
+ let(:country_code) { "SE" }
980
1001
  let(:bank_code) { nil }
981
- let(:account_number) { '5013-1007270' }
1002
+ let(:account_number) { "5013-1007270" }
982
1003
 
983
- its([:account_number]) { is_expected.to eq('1007270') }
984
- its([:branch_code]) { is_expected.to eq('5013') }
985
- its([:swift_bank_code]) { is_expected.to eq('500') }
986
- its([:swift_account_number]) { is_expected.to eq('00000050131007270') }
1004
+ its([:account_number]) { is_expected.to eq("1007270") }
1005
+ its([:branch_code]) { is_expected.to eq("5013") }
1006
+ its([:swift_bank_code]) { is_expected.to eq("500") }
1007
+ its([:swift_account_number]) { is_expected.to eq("00000050131007270") }
987
1008
 
988
- context 'without an account number' do
1009
+ context "without an account number" do
989
1010
  let(:account_number) { nil }
990
- it { is_expected.to eq(local_details) }
1011
+ it { is_expected.to eq(local_details_with_swift) }
991
1012
  end
992
1013
 
993
- context 'with a bank code' do
994
- let(:bank_code) { '501' }
1014
+ context "with a bank code" do
1015
+ let(:bank_code) { "501" }
995
1016
 
996
1017
  # Doesn't do any conversion
997
- its([:swift_bank_code]) { is_expected.to eq('501') }
998
- its([:bank_code]) { is_expected.to eq('501') }
999
- its([:account_number]) { is_expected.to eq('5013-1007270') }
1000
- its([:swift_account_number]) { is_expected.to eq('5013-1007270') }
1018
+ its([:swift_bank_code]) { is_expected.to eq("501") }
1019
+ its([:bank_code]) { is_expected.to eq("501") }
1020
+ its([:account_number]) { is_expected.to eq("5013-1007270") }
1021
+ its([:swift_account_number]) { is_expected.to eq("5013-1007270") }
1001
1022
  end
1002
1023
  end
1003
1024
 
1004
- context 'Slovenia' do
1005
- let(:country_code) { 'SI' }
1006
- let(:bank_code) { '19100' }
1007
- let(:account_number) { '0000123438' }
1025
+ context "Slovenia" do
1026
+ let(:country_code) { "SI" }
1027
+ let(:bank_code) { "19100" }
1028
+ let(:account_number) { "0000123438" }
1008
1029
 
1009
1030
  it { is_expected.to eq(local_details_with_swift) }
1010
1031
 
1011
- context 'with an account number which needs zero-padding' do
1012
- let(:account_number) { '123438' }
1013
- its([:account_number]) { is_expected.to eq('0000123438') }
1032
+ context "with an account number which needs zero-padding" do
1033
+ let(:account_number) { "123438" }
1034
+ its([:account_number]) { is_expected.to eq("0000123438") }
1014
1035
  end
1015
1036
 
1016
- context 'without a bank code' do
1037
+ context "without a bank code" do
1017
1038
  let(:bank_code) { nil }
1018
1039
  it { is_expected.to eq(local_details_with_swift) }
1019
1040
  end
1020
1041
 
1021
- context 'without an account number' do
1042
+ context "without an account number" do
1022
1043
  let(:account_number) { nil }
1023
1044
  it { is_expected.to eq(local_details_with_swift) }
1024
1045
  end
1025
1046
  end
1026
1047
 
1027
- context 'Slovak Republic' do
1028
- let(:country_code) { 'SK' }
1029
- let(:bank_code) { '1200' }
1030
- let(:account_number) { '0000198742637541' }
1048
+ context "Slovak Republic" do
1049
+ let(:country_code) { "SK" }
1050
+ let(:bank_code) { "1200" }
1051
+ let(:account_number) { "0000198742637541" }
1031
1052
 
1032
1053
  it { is_expected.to eq(local_details_with_swift) }
1033
1054
 
1034
- context 'with an account number prefix' do
1035
- let(:prefix) { '000019' }
1036
- let(:account_number) { '8742637541' }
1055
+ context "with an account number prefix" do
1056
+ let(:prefix) { "000019" }
1057
+ let(:account_number) { "8742637541" }
1037
1058
  before { local_details.merge!(account_number_prefix: prefix) }
1038
1059
 
1039
- its([:account_number]) { is_expected.to eq('0000198742637541') }
1060
+ its([:account_number]) { is_expected.to eq("0000198742637541") }
1040
1061
 
1041
- context 'which needs zero-padding' do
1042
- let(:prefix) { '19' }
1043
- its([:account_number]) { is_expected.to eq('0000198742637541') }
1062
+ context "which needs zero-padding" do
1063
+ let(:prefix) { "19" }
1064
+ its([:account_number]) { is_expected.to eq("0000198742637541") }
1044
1065
  end
1045
1066
  end
1046
1067
 
1047
- context 'without a bank code' do
1068
+ context "without a bank code" do
1048
1069
  let(:bank_code) { nil }
1049
1070
  it { is_expected.to eq(local_details_with_swift) }
1050
1071
  end
1051
1072
 
1052
- context 'without an account number' do
1073
+ context "without an account number" do
1053
1074
  let(:account_number) { nil }
1054
1075
  it { is_expected.to eq(local_details_with_swift) }
1055
1076
  end
1056
1077
  end
1057
1078
 
1058
- context 'San Marino' do
1059
- let(:country_code) { 'SM' }
1060
- let(:bank_code) { '05428' }
1061
- let(:branch_code) { '11101' }
1062
- let(:account_number) { '000000123456' }
1079
+ context "San Marino" do
1080
+ let(:country_code) { "SM" }
1081
+ let(:bank_code) { "05428" }
1082
+ let(:branch_code) { "11101" }
1083
+ let(:account_number) { "000000123456" }
1063
1084
 
1064
1085
  it { is_expected.to eq(local_details_with_swift) }
1065
1086
 
1066
- context 'with an explicit check digit' do
1067
- before { local_details.merge!(check_digit: 'Y') }
1087
+ context "with an explicit check digit" do
1088
+ before { local_details.merge!(check_digit: "Y") }
1068
1089
  it { is_expected.to eq(local_details_with_swift) }
1069
1090
  end
1070
1091
 
1071
- context 'with the account number not zero-padded' do
1072
- let(:account_number) { '123456' }
1073
- its([:account_number]) { is_expected.to eq('000000123456') }
1092
+ context "with the account number not zero-padded" do
1093
+ let(:account_number) { "123456" }
1094
+ its([:account_number]) { is_expected.to eq("000000123456") }
1074
1095
  end
1075
1096
 
1076
- context 'without a bank code' do
1097
+ context "without a bank code" do
1077
1098
  let(:bank_code) { nil }
1078
1099
  it { is_expected.to eq(local_details_with_swift) }
1079
1100
  end
1080
1101
 
1081
- context 'without a branch code' do
1102
+ context "without a branch code" do
1082
1103
  let(:branch_code) { nil }
1083
1104
  it { is_expected.to eq(local_details_with_swift) }
1084
1105
  end
1085
1106
 
1086
- context 'without an account number' do
1107
+ context "without an account number" do
1087
1108
  let(:account_number) { nil }
1088
1109
  it { is_expected.to eq(local_details_with_swift) }
1089
1110
  end