ibandit 0.11.6 → 0.11.7
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 +4 -4
- data/.rubocop.yml +7 -6
- data/.rubocop_todo.yml +4 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +8 -0
- data/README.md +90 -30
- data/data/structures.yml +9 -0
- data/ibandit.gemspec +23 -19
- data/lib/ibandit.rb +18 -18
- data/lib/ibandit/check_digit.rb +8 -8
- data/lib/ibandit/constants.rb +14 -5
- data/lib/ibandit/german_details_converter.rb +598 -598
- data/lib/ibandit/iban.rb +90 -37
- data/lib/ibandit/iban_assembler.rb +15 -13
- data/lib/ibandit/iban_splitter.rb +4 -4
- data/lib/ibandit/local_details_cleaner.rb +94 -85
- data/lib/ibandit/pseudo_iban_assembler.rb +2 -2
- data/lib/ibandit/pseudo_iban_splitter.rb +15 -25
- data/lib/ibandit/sweden/bank_lookup.rb +1 -1
- data/lib/ibandit/sweden/local_details_converter.rb +7 -7
- data/lib/ibandit/sweden/validator.rb +5 -5
- data/lib/ibandit/version.rb +1 -1
- data/spec/ibandit/german_details_converter_spec.rb +23 -22
- data/spec/ibandit/iban_assembler_spec.rb +310 -310
- data/spec/ibandit/iban_spec.rb +1087 -712
- data/spec/ibandit/iban_splitter_spec.rb +14 -14
- data/spec/ibandit/local_details_cleaner_spec.rb +473 -452
- data/spec/ibandit/pseudo_iban_assembler_spec.rb +54 -18
- data/spec/ibandit/pseudo_iban_splitter_spec.rb +13 -22
- data/spec/ibandit/structure_spec.rb +3 -3
- data/spec/ibandit/sweden/local_details_converter_spec.rb +125 -125
- data/spec/ibandit/sweden/validator_spec.rb +88 -88
- data/spec/spec_helper.rb +10 -10
- metadata +48 -20
data/spec/ibandit/iban_spec.rb
CHANGED
@@ -1,67 +1,67 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
describe Ibandit::IBAN do
|
4
4
|
subject(:iban) { described_class.new(arg) }
|
5
5
|
let(:arg) { iban_code }
|
6
|
-
let(:iban_code) {
|
6
|
+
let(:iban_code) { "GB82WEST12345698765432" }
|
7
7
|
|
8
8
|
its(:iban) { is_expected.to eq(iban_code) }
|
9
9
|
|
10
|
-
context
|
10
|
+
context "with a poorly formatted IBAN" do
|
11
11
|
let(:iban_code) { " gb82 WeSt 1234 5698 7654 32\n" }
|
12
|
-
its(:iban) { is_expected.to eq(
|
12
|
+
its(:iban) { is_expected.to eq("GB82WEST12345698765432") }
|
13
13
|
end
|
14
14
|
|
15
|
-
context
|
15
|
+
context "with nil" do
|
16
16
|
let(:arg) { nil }
|
17
17
|
specify { expect { iban }.to raise_error(TypeError) }
|
18
18
|
end
|
19
19
|
|
20
|
-
context
|
21
|
-
let(:arg) {
|
22
|
-
its(:iban) { is_expected.to eq(
|
20
|
+
context "with an invalid pseudo IBAN" do
|
21
|
+
let(:arg) { "dezzzz" }
|
22
|
+
its(:iban) { is_expected.to eq("DEZZZZ") }
|
23
23
|
end
|
24
24
|
|
25
|
-
context
|
25
|
+
context "with local details" do
|
26
26
|
let(:arg) do
|
27
27
|
{
|
28
|
-
country_code:
|
29
|
-
bank_code:
|
30
|
-
branch_code:
|
31
|
-
account_number:
|
28
|
+
country_code: "GB",
|
29
|
+
bank_code: "WEST",
|
30
|
+
branch_code: "123456",
|
31
|
+
account_number: "98765432",
|
32
32
|
}
|
33
33
|
end
|
34
34
|
|
35
|
-
its(:iban) { is_expected.to eq(
|
35
|
+
its(:iban) { is_expected.to eq("GB82WEST12345698765432") }
|
36
36
|
end
|
37
37
|
|
38
|
-
context
|
38
|
+
context "with nil local details" do
|
39
39
|
let(:arg) do
|
40
40
|
{
|
41
41
|
country_code: nil,
|
42
42
|
bank_code: nil,
|
43
43
|
branch_code: nil,
|
44
|
-
account_number: nil
|
44
|
+
account_number: nil,
|
45
45
|
}
|
46
46
|
end
|
47
47
|
|
48
48
|
it { is_expected.to_not be_valid }
|
49
49
|
end
|
50
50
|
|
51
|
-
describe
|
52
|
-
its(:country_code) { is_expected.to eq(
|
53
|
-
its(:check_digits) { is_expected.to eq(
|
54
|
-
its(:bank_code) { is_expected.to eq(
|
55
|
-
its(:branch_code) { is_expected.to eq(
|
56
|
-
its(:account_number) { is_expected.to eq(
|
57
|
-
its(:swift_bank_code) { is_expected.to eq(
|
58
|
-
its(:swift_branch_code) { is_expected.to eq(
|
59
|
-
its(:swift_account_number) { is_expected.to eq(
|
60
|
-
its(:swift_national_id) { is_expected.to eq(
|
51
|
+
describe "it decomposes the IBAN" do
|
52
|
+
its(:country_code) { is_expected.to eq("GB") }
|
53
|
+
its(:check_digits) { is_expected.to eq("82") }
|
54
|
+
its(:bank_code) { is_expected.to eq("WEST") }
|
55
|
+
its(:branch_code) { is_expected.to eq("123456") }
|
56
|
+
its(:account_number) { is_expected.to eq("98765432") }
|
57
|
+
its(:swift_bank_code) { is_expected.to eq("WEST") }
|
58
|
+
its(:swift_branch_code) { is_expected.to eq("123456") }
|
59
|
+
its(:swift_account_number) { is_expected.to eq("98765432") }
|
60
|
+
its(:swift_national_id) { is_expected.to eq("WEST123456") }
|
61
61
|
its(:local_check_digits) { is_expected.to be_nil }
|
62
62
|
|
63
|
-
context
|
64
|
-
let(:iban_code) {
|
63
|
+
context "when the IBAN is blank" do
|
64
|
+
let(:iban_code) { "" }
|
65
65
|
|
66
66
|
its(:country_code) { is_expected.to be_nil }
|
67
67
|
its(:check_digits) { is_expected.to be_nil }
|
@@ -73,41 +73,41 @@ describe Ibandit::IBAN do
|
|
73
73
|
its(:local_check_digits) { is_expected.to be_nil }
|
74
74
|
end
|
75
75
|
|
76
|
-
context
|
77
|
-
let(:iban_code) {
|
76
|
+
context "when local details are not available" do
|
77
|
+
let(:iban_code) { "SE2680000000075071211203" }
|
78
78
|
|
79
|
-
its(:country_code) { is_expected.to eq(
|
80
|
-
its(:check_digits) { is_expected.to eq(
|
79
|
+
its(:country_code) { is_expected.to eq("SE") }
|
80
|
+
its(:check_digits) { is_expected.to eq("26") }
|
81
81
|
its(:bank_code) { is_expected.to be_nil }
|
82
82
|
its(:branch_code) { is_expected.to be_nil }
|
83
83
|
its(:account_number) { is_expected.to be_nil }
|
84
|
-
its(:swift_bank_code) { is_expected.to eq(
|
84
|
+
its(:swift_bank_code) { is_expected.to eq("800") }
|
85
85
|
its(:swift_branch_code) { is_expected.to be_nil }
|
86
|
-
its(:swift_account_number) { is_expected.to eq(
|
87
|
-
its(:swift_national_id) { is_expected.to eq(
|
86
|
+
its(:swift_account_number) { is_expected.to eq("00000075071211203") }
|
87
|
+
its(:swift_national_id) { is_expected.to eq("800") }
|
88
88
|
its(:local_check_digits) { is_expected.to be_nil }
|
89
89
|
end
|
90
90
|
|
91
|
-
context
|
92
|
-
let(:iban_code) {
|
93
|
-
its(:country_code) { is_expected.to eq(
|
94
|
-
its(:bank_code) { is_expected.to eq(
|
91
|
+
context "when the IBAN was created from a Slovenian IBAN" do
|
92
|
+
let(:iban_code) { "SI56 1910 0000 0123 438" }
|
93
|
+
its(:country_code) { is_expected.to eq("SI") }
|
94
|
+
its(:bank_code) { is_expected.to eq("19100") }
|
95
95
|
its(:branch_code) { is_expected.to be_nil }
|
96
|
-
its(:account_number) { is_expected.to eq(
|
97
|
-
its(:swift_bank_code) { is_expected.to eq(
|
96
|
+
its(:account_number) { is_expected.to eq("0000123438") }
|
97
|
+
its(:swift_bank_code) { is_expected.to eq("19100") }
|
98
98
|
its(:swift_branch_code) { is_expected.to be_nil }
|
99
|
-
its(:swift_account_number) { is_expected.to eq(
|
100
|
-
its(:swift_national_id) { is_expected.to eq(
|
99
|
+
its(:swift_account_number) { is_expected.to eq("0000123438") }
|
100
|
+
its(:swift_national_id) { is_expected.to eq("19100") }
|
101
101
|
its(:local_check_digits) { is_expected.to be_nil }
|
102
102
|
end
|
103
103
|
|
104
|
-
context
|
104
|
+
context "when the IBAN was created with local details" do
|
105
105
|
let(:arg) do
|
106
106
|
{
|
107
|
-
country_code:
|
108
|
-
bank_code:
|
109
|
-
branch_code:
|
110
|
-
account_number:
|
107
|
+
country_code: "GB",
|
108
|
+
bank_code: "WES",
|
109
|
+
branch_code: "1234",
|
110
|
+
account_number: "5678",
|
111
111
|
}
|
112
112
|
end
|
113
113
|
|
@@ -118,14 +118,17 @@ describe Ibandit::IBAN do
|
|
118
118
|
its(:swift_bank_code) { is_expected.to eq(arg[:bank_code]) }
|
119
119
|
its(:swift_branch_code) { is_expected.to eq(arg[:branch_code]) }
|
120
120
|
its(:swift_account_number) { is_expected.to eq(arg[:account_number]) }
|
121
|
+
its(:pseudo_iban) { is_expected.to be_nil }
|
122
|
+
its(:iban) { is_expected.to eq("GB72WES12345678") }
|
123
|
+
its(:to_s) { is_expected.to eq("GB72WES12345678") }
|
121
124
|
end
|
122
125
|
|
123
|
-
context
|
126
|
+
context "when the IBAN was created with local details for Sweden" do
|
124
127
|
let(:arg) do
|
125
128
|
{
|
126
|
-
country_code:
|
127
|
-
branch_code:
|
128
|
-
account_number:
|
129
|
+
country_code: "SE",
|
130
|
+
branch_code: "1281",
|
131
|
+
account_number: "0105723",
|
129
132
|
}
|
130
133
|
end
|
131
134
|
|
@@ -133,842 +136,928 @@ describe Ibandit::IBAN do
|
|
133
136
|
its(:bank_code) { is_expected.to eq(arg[:bank_code]) }
|
134
137
|
its(:branch_code) { is_expected.to eq(arg[:branch_code]) }
|
135
138
|
its(:account_number) { is_expected.to eq(arg[:account_number]) }
|
136
|
-
its(:swift_bank_code) { is_expected.to eq(
|
139
|
+
its(:swift_bank_code) { is_expected.to eq("120") }
|
137
140
|
its(:swift_branch_code) { is_expected.to be_nil }
|
138
|
-
its(:swift_account_number) { is_expected.to eq(
|
139
|
-
its(:iban) { is_expected.to eq(
|
140
|
-
its(:pseudo_iban) { is_expected.to eq(
|
141
|
+
its(:swift_account_number) { is_expected.to eq("00000012810105723") }
|
142
|
+
its(:iban) { is_expected.to eq("SE5412000000012810105723") }
|
143
|
+
its(:pseudo_iban) { is_expected.to eq("SEZZX1281XXX0105723") }
|
144
|
+
its(:to_s) { is_expected.to eq("SE5412000000012810105723") }
|
141
145
|
end
|
142
146
|
|
143
|
-
context
|
144
|
-
let(:arg) {
|
147
|
+
context "when the IBAN was created from a pseudo-IBAN" do
|
148
|
+
let(:arg) { "SEZZX1281XXX0105723" }
|
145
149
|
|
146
|
-
its(:country_code) { is_expected.to eq(
|
150
|
+
its(:country_code) { is_expected.to eq("SE") }
|
147
151
|
its(:bank_code) { is_expected.to be_nil }
|
148
|
-
its(:branch_code) { is_expected.to eq(
|
149
|
-
its(:account_number) { is_expected.to eq(
|
150
|
-
its(:swift_bank_code) { is_expected.to eq(
|
152
|
+
its(:branch_code) { is_expected.to eq("1281") }
|
153
|
+
its(:account_number) { is_expected.to eq("0105723") }
|
154
|
+
its(:swift_bank_code) { is_expected.to eq("120") }
|
151
155
|
its(:swift_branch_code) { is_expected.to be_nil }
|
152
|
-
its(:swift_account_number) { is_expected.to eq(
|
153
|
-
its(:iban) { is_expected.to eq(
|
154
|
-
its(:pseudo_iban) { is_expected.to eq(
|
156
|
+
its(:swift_account_number) { is_expected.to eq("00000012810105723") }
|
157
|
+
its(:iban) { is_expected.to eq("SE5412000000012810105723") }
|
158
|
+
its(:pseudo_iban) { is_expected.to eq("SEZZX1281XXX0105723") }
|
159
|
+
its(:to_s) { is_expected.to eq("SE5412000000012810105723") }
|
160
|
+
end
|
161
|
+
|
162
|
+
context "when the IBAN was created with local details for Australia" do
|
163
|
+
let(:arg) do
|
164
|
+
{
|
165
|
+
country_code: "AU",
|
166
|
+
branch_code: "123-456",
|
167
|
+
account_number: "123456789",
|
168
|
+
}
|
169
|
+
end
|
170
|
+
|
171
|
+
its(:country_code) { is_expected.to eq(arg[:country_code]) }
|
172
|
+
its(:bank_code) { is_expected.to be_nil }
|
173
|
+
its(:branch_code) { is_expected.to eq("123456") }
|
174
|
+
its(:account_number) { is_expected.to eq("123456789") }
|
175
|
+
its(:swift_bank_code) { is_expected.to be_nil }
|
176
|
+
its(:swift_branch_code) { is_expected.to eq("123456") }
|
177
|
+
its(:swift_account_number) { is_expected.to eq("123456789") }
|
178
|
+
its(:iban) { is_expected.to be_nil }
|
179
|
+
its(:pseudo_iban) { is_expected.to eq("AUZZ123456123456789") }
|
180
|
+
its(:valid?) { is_expected.to eq(true) }
|
181
|
+
its(:to_s) { is_expected.to eq("") }
|
182
|
+
end
|
183
|
+
|
184
|
+
context "when the IBAN was created from an Australian pseudo-IBAN" do
|
185
|
+
let(:arg) { "AUZZ123456123456789" }
|
186
|
+
|
187
|
+
its(:country_code) { is_expected.to eq("AU") }
|
188
|
+
its(:bank_code) { is_expected.to be_nil }
|
189
|
+
its(:branch_code) { is_expected.to eq("123456") }
|
190
|
+
its(:account_number) { is_expected.to eq("123456789") }
|
191
|
+
its(:swift_bank_code) { is_expected.to be_nil }
|
192
|
+
its(:swift_branch_code) { is_expected.to eq("123456") }
|
193
|
+
its(:swift_account_number) { is_expected.to eq("123456789") }
|
194
|
+
its(:iban) { is_expected.to be_nil }
|
195
|
+
its(:pseudo_iban) { is_expected.to eq("AUZZ123456123456789") }
|
196
|
+
its(:valid?) { is_expected.to eq(true) }
|
197
|
+
its(:to_s) { is_expected.to eq("") }
|
198
|
+
end
|
199
|
+
|
200
|
+
context "when the input is an invalid Australian pseudo-IBAN" do
|
201
|
+
let(:arg) { "AUZZ1234561234567899999" }
|
202
|
+
|
203
|
+
its(:iban) { is_expected.to be_nil }
|
204
|
+
its(:pseudo_iban) { is_expected.to eq(arg) }
|
205
|
+
it "is invalid and has the correct errors" do
|
206
|
+
expect(subject.valid?).to eq(false)
|
207
|
+
expect(subject.errors).
|
208
|
+
to eq(account_number: "is the wrong length (should be 9 characters)")
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
context "when the input is invalid local details for Australia" do
|
213
|
+
let(:arg) do
|
214
|
+
{
|
215
|
+
country_code: "AU",
|
216
|
+
branch_code: "123-4XX",
|
217
|
+
account_number: "1234567XX",
|
218
|
+
}
|
219
|
+
end
|
220
|
+
|
221
|
+
its(:iban) { is_expected.to be_nil }
|
222
|
+
its(:pseudo_iban) { is_expected.to eq("AUZZ1234XX1234567XX") }
|
223
|
+
it "is invalid and has the correct errors" do
|
224
|
+
expect(subject.valid?).to eq(false)
|
225
|
+
expect(subject.errors).to eq(account_number: "is invalid",
|
226
|
+
branch_code: "is invalid")
|
227
|
+
end
|
155
228
|
end
|
156
229
|
end
|
157
230
|
|
158
|
-
describe
|
159
|
-
specify { expect(iban.to_s).to eq(
|
160
|
-
specify { expect(iban.to_s(:compact)).to eq(
|
231
|
+
describe "#to_s" do
|
232
|
+
specify { expect(iban.to_s).to eq("GB82WEST12345698765432") }
|
233
|
+
specify { expect(iban.to_s(:compact)).to eq("GB82WEST12345698765432") }
|
161
234
|
|
162
|
-
it
|
163
|
-
expect(iban.to_s(:formatted)).to eq(
|
235
|
+
it "returns a prettified string when passed :formatted" do
|
236
|
+
expect(iban.to_s(:formatted)).to eq("GB82 WEST 1234 5698 7654 32")
|
164
237
|
end
|
165
238
|
|
166
239
|
specify { expect { iban.to_s(:russian) }.to raise_error ArgumentError }
|
167
240
|
|
168
|
-
context
|
169
|
-
let(:arg) { { country_code:
|
241
|
+
context "with the IBAN is nil" do
|
242
|
+
let(:arg) { { country_code: "GB" } }
|
170
243
|
its(:to_s) { is_expected.to_not be_nil }
|
171
244
|
specify { expect(iban.to_s(:formatted)).to be_empty }
|
172
245
|
end
|
246
|
+
|
247
|
+
context "with Swedish local details" do
|
248
|
+
let(:arg) do
|
249
|
+
{
|
250
|
+
country_code: "SE",
|
251
|
+
branch_code: "1281",
|
252
|
+
account_number: "0105723",
|
253
|
+
}
|
254
|
+
end
|
255
|
+
specify { expect(iban.to_s).to eq("SE5412000000012810105723") }
|
256
|
+
end
|
257
|
+
|
258
|
+
context "with a Swedish pseudo-IBAN" do
|
259
|
+
let(:arg) { "SEZZX1281XXX0105723" }
|
260
|
+
specify { expect(iban.to_s).to eq("SE5412000000012810105723") }
|
261
|
+
end
|
173
262
|
end
|
174
263
|
|
175
264
|
###############
|
176
265
|
# Validations #
|
177
266
|
###############
|
178
267
|
|
179
|
-
describe
|
268
|
+
describe "#valid_country_code?" do
|
180
269
|
subject { iban.valid_country_code? }
|
181
270
|
|
182
|
-
context
|
271
|
+
context "with valid details" do
|
183
272
|
it { is_expected.to eq(true) }
|
184
273
|
end
|
185
274
|
|
186
|
-
context
|
275
|
+
context "with an unknown country code" do
|
187
276
|
before { iban.valid_country_code? }
|
188
|
-
let(:iban_code) {
|
277
|
+
let(:iban_code) { "AA123456789123456" }
|
189
278
|
it { is_expected.to eq(false) }
|
190
279
|
|
191
|
-
context
|
192
|
-
it
|
280
|
+
context "locale en", locale: :en do
|
281
|
+
it "sets errors on the IBAN" do
|
193
282
|
iban.valid_country_code?
|
194
283
|
expect(iban.errors).
|
195
284
|
to include(country_code: "'AA' is not a valid ISO 3166-1 IBAN " \
|
196
|
-
|
285
|
+
"country code")
|
197
286
|
end
|
198
287
|
end
|
199
288
|
|
200
|
-
context
|
201
|
-
it
|
289
|
+
context "locale de", locale: :de do
|
290
|
+
it "sets errors on the IBAN" do
|
202
291
|
iban.valid_country_code?
|
203
292
|
expect(iban.errors).
|
204
293
|
to include(country_code: "'AA' ist keine gültige IBAN " \
|
205
|
-
|
294
|
+
"Länderkennung")
|
206
295
|
end
|
207
296
|
end
|
208
297
|
|
209
|
-
context
|
210
|
-
it
|
298
|
+
context "locale pt", locale: :pt do
|
299
|
+
it "sets errors on the IBAN" do
|
211
300
|
iban.valid_country_code?
|
212
301
|
expect(iban.errors).
|
213
302
|
to include(country_code: "'AA' não é um código IBAN válido para " \
|
214
|
-
|
303
|
+
"país segundo o ISO 3166-1")
|
215
304
|
end
|
216
305
|
end
|
217
306
|
|
218
|
-
context
|
219
|
-
it
|
307
|
+
context "locale nl", locale: :nl do
|
308
|
+
it "sets errors on the IBAN" do
|
220
309
|
iban.valid_country_code?
|
221
310
|
expect(iban.errors).
|
222
311
|
to include(country_code: "'AA' is geen geldig ISO 3166-1 IBAN " \
|
223
|
-
|
312
|
+
"landcode")
|
224
313
|
end
|
225
314
|
end
|
226
315
|
end
|
227
316
|
end
|
228
317
|
|
229
|
-
describe
|
318
|
+
describe "#valid_check_digits?" do
|
230
319
|
subject { iban.valid_check_digits? }
|
231
320
|
|
232
|
-
context
|
233
|
-
let(:iban_code) {
|
321
|
+
context "with valid details" do
|
322
|
+
let(:iban_code) { "GB82WEST12345698765432" }
|
234
323
|
it { is_expected.to eq(true) }
|
235
324
|
|
236
|
-
context
|
237
|
-
let(:iban_code) {
|
325
|
+
context "where the check digit is zero-padded" do
|
326
|
+
let(:iban_code) { "GB06WEST12345698765442" }
|
238
327
|
it { is_expected.to eq(true) }
|
239
328
|
end
|
240
329
|
end
|
241
330
|
|
242
|
-
context
|
243
|
-
let(:iban_code) {
|
331
|
+
context "with invalid details" do
|
332
|
+
let(:iban_code) { "GB12WEST12345698765432" }
|
244
333
|
it { is_expected.to eq(false) }
|
245
334
|
|
246
|
-
context
|
247
|
-
it
|
335
|
+
context "locale en", locale: :en do
|
336
|
+
it "sets errors on the IBAN" do
|
248
337
|
iban.valid_check_digits?
|
249
338
|
expect(iban.errors).
|
250
|
-
to include(check_digits:
|
339
|
+
to include(check_digits: "Check digits failed modulus check. " \
|
251
340
|
"Expected '82', received '12'.")
|
252
341
|
end
|
253
342
|
end
|
254
343
|
|
255
|
-
context
|
256
|
-
it
|
344
|
+
context "locale fr", locale: :fr do
|
345
|
+
it "sets errors on the IBAN" do
|
257
346
|
iban.valid_check_digits?
|
258
347
|
expect(iban.errors).
|
259
|
-
to include(check_digits:
|
348
|
+
to include(check_digits: "Les chiffres de vérification ont " \
|
260
349
|
"échoué les tests de modulo. '82' " \
|
261
350
|
"attendu, '12' reçu.")
|
262
351
|
end
|
263
352
|
end
|
264
353
|
|
265
|
-
context
|
266
|
-
it
|
354
|
+
context "locale de", locale: :de do
|
355
|
+
it "sets errors on the IBAN" do
|
267
356
|
iban.valid_check_digits?
|
268
357
|
expect(iban.errors).
|
269
|
-
to include(check_digits:
|
358
|
+
to include(check_digits: "Die Prüfzahlen sind inkorrekt. " \
|
270
359
|
"Erwartet wurde '82', tatsächlich " \
|
271
360
|
"erhalten '12'.")
|
272
361
|
end
|
273
362
|
end
|
274
363
|
|
275
|
-
context
|
276
|
-
it
|
364
|
+
context "locale pt", locale: :pt do
|
365
|
+
it "sets errors on the IBAN" do
|
277
366
|
iban.valid_check_digits?
|
278
367
|
expect(iban.errors).
|
279
|
-
to include(check_digits:
|
368
|
+
to include(check_digits: "Dígitos de controlo falharam a " \
|
280
369
|
"verificação. Esperados '82', " \
|
281
370
|
"recebidos '12'.")
|
282
371
|
end
|
283
372
|
end
|
284
373
|
|
285
|
-
context
|
286
|
-
it
|
374
|
+
context "locale es", locale: :es do
|
375
|
+
it "sets errors on the IBAN" do
|
287
376
|
iban.valid_check_digits?
|
288
377
|
expect(iban.errors).
|
289
|
-
to include(check_digits:
|
290
|
-
|
378
|
+
to include(check_digits: "Los dígitos de control no han pasado " \
|
379
|
+
"la verificación de módulo. Se " \
|
291
380
|
"esperaba '82', se ha recibido '12'.")
|
292
381
|
end
|
293
382
|
end
|
294
383
|
|
295
|
-
context
|
296
|
-
it
|
384
|
+
context "locale it", locale: :it do
|
385
|
+
it "sets errors on the IBAN" do
|
297
386
|
iban.valid_check_digits?
|
298
387
|
expect(iban.errors).
|
299
|
-
to include(check_digits:
|
388
|
+
to include(check_digits: "la cifra di controllo non ha superato " \
|
300
389
|
"il controllo del modulo. Previsto '82'" \
|
301
390
|
", ricevuto '12'.")
|
302
391
|
end
|
303
392
|
end
|
304
393
|
|
305
|
-
context
|
306
|
-
it
|
394
|
+
context "locale nl", locale: :nl do
|
395
|
+
it "sets errors on the IBAN" do
|
307
396
|
iban.valid_check_digits?
|
308
397
|
expect(iban.errors).
|
309
|
-
to include(check_digits:
|
398
|
+
to include(check_digits: "Controlegetal mislukte modulus check. " \
|
310
399
|
"Verwachte '82', ontvangen '12'.")
|
311
400
|
end
|
312
401
|
end
|
313
402
|
end
|
314
403
|
|
315
|
-
context
|
316
|
-
let(:iban_code) {
|
404
|
+
context "with invalid characters" do
|
405
|
+
let(:iban_code) { "AA82-EST123456987654" }
|
317
406
|
it { is_expected.to be_nil }
|
318
407
|
|
319
|
-
it
|
408
|
+
it "does not set errors on the IBAN" do
|
320
409
|
iban.valid_check_digits?
|
321
410
|
expect(iban.errors).to_not include(:check_digits)
|
322
411
|
end
|
323
412
|
end
|
324
413
|
|
325
|
-
context
|
326
|
-
let(:iban_code) {
|
414
|
+
context "with an empty IBAN" do
|
415
|
+
let(:iban_code) { "" }
|
327
416
|
it { is_expected.to be_nil }
|
328
417
|
|
329
|
-
it
|
418
|
+
it "does not set errors on the IBAN" do
|
330
419
|
iban.valid_check_digits?
|
331
420
|
expect(iban.errors).to_not include(:check_digits)
|
332
421
|
end
|
333
422
|
end
|
334
423
|
end
|
335
424
|
|
336
|
-
describe
|
425
|
+
describe "#valid_length?" do
|
337
426
|
subject { iban.valid_length? }
|
338
427
|
|
339
|
-
context
|
428
|
+
context "with valid details" do
|
340
429
|
it { is_expected.to eq(true) }
|
341
430
|
end
|
342
431
|
|
343
|
-
context
|
344
|
-
let(:iban_code) {
|
432
|
+
context "with invalid details" do
|
433
|
+
let(:iban_code) { "GB82WEST123456987654" }
|
345
434
|
it { is_expected.to eq(false) }
|
346
435
|
|
347
|
-
context
|
348
|
-
it
|
436
|
+
context "locale en", locale: :en do
|
437
|
+
it "sets errors on the IBAN" do
|
349
438
|
iban.valid_length?
|
350
439
|
expect(iban.errors).
|
351
440
|
to include(length: "Length doesn't match SWIFT specification " \
|
352
|
-
|
441
|
+
"(expected 22 characters, received 20)")
|
353
442
|
end
|
354
443
|
end
|
355
444
|
|
356
|
-
context
|
357
|
-
it
|
445
|
+
context "locale fr", locale: :fr do
|
446
|
+
it "sets errors on the IBAN" do
|
358
447
|
iban.valid_length?
|
359
448
|
expect(iban.errors).
|
360
|
-
to include(length:
|
361
|
-
|
362
|
-
|
449
|
+
to include(length: "La longueur ne correspond pas aux " \
|
450
|
+
"spécifications SWIFT (22 caractères " \
|
451
|
+
"attendus, 20 reçus)")
|
363
452
|
end
|
364
453
|
end
|
365
454
|
|
366
|
-
context
|
367
|
-
it
|
455
|
+
context "locale de", locale: :de do
|
456
|
+
it "sets errors on the IBAN" do
|
368
457
|
iban.valid_length?
|
369
458
|
expect(iban.errors).
|
370
|
-
to include(length:
|
371
|
-
|
372
|
-
|
459
|
+
to include(length: "Die Länge stimmt nicht mit der SWIFT " \
|
460
|
+
"Spezifikation überein (erwartet wurden 22 " \
|
461
|
+
"Zeichen, tatsächlich erhalten 20)")
|
373
462
|
end
|
374
463
|
end
|
375
464
|
|
376
|
-
context
|
377
|
-
it
|
465
|
+
context "locale pt", locale: :pt do
|
466
|
+
it "sets errors on the IBAN" do
|
378
467
|
iban.valid_length?
|
379
468
|
expect(iban.errors).
|
380
|
-
to include(length:
|
381
|
-
|
469
|
+
to include(length: "O tamanho não está segundo a especificação " \
|
470
|
+
"SWIFT (esperados 22 caracteres, recebidos 20)")
|
382
471
|
end
|
383
472
|
end
|
384
473
|
|
385
|
-
context
|
386
|
-
it
|
474
|
+
context "locale es", locale: :es do
|
475
|
+
it "sets errors on the IBAN" do
|
387
476
|
iban.valid_length?
|
388
477
|
expect(iban.errors).
|
389
|
-
to include(length:
|
390
|
-
|
391
|
-
|
478
|
+
to include(length: "La longitud no corresponde a la " \
|
479
|
+
"especificación SWIFT (Se esperaba 22 " \
|
480
|
+
"símbolos, se ha recibido 20)")
|
392
481
|
end
|
393
482
|
end
|
394
483
|
|
395
|
-
context
|
396
|
-
it
|
484
|
+
context "locale it", locale: :it do
|
485
|
+
it "sets errors on the IBAN" do
|
397
486
|
iban.valid_length?
|
398
487
|
expect(iban.errors).
|
399
|
-
to include(length:
|
400
|
-
|
488
|
+
to include(length: "La lunghezza non corrisponde ai requisiti " \
|
489
|
+
"SWIFT (Previsti 22 caratteri, ricevuti 20)")
|
401
490
|
end
|
402
491
|
end
|
403
492
|
|
404
|
-
context
|
405
|
-
it
|
493
|
+
context "locale nl", locale: :nl do
|
494
|
+
it "sets errors on the IBAN" do
|
406
495
|
iban.valid_length?
|
407
496
|
expect(iban.errors).
|
408
|
-
to include(length:
|
409
|
-
|
410
|
-
|
497
|
+
to include(length: "Lengte komt niet overeen met SWIFT-" \
|
498
|
+
"specificatie (verwachte 22 karakters, " \
|
499
|
+
"ontvangen 20)")
|
411
500
|
end
|
412
501
|
end
|
413
502
|
end
|
414
503
|
|
415
|
-
context
|
416
|
-
let(:iban_code) {
|
504
|
+
context "with an invalid country_code" do
|
505
|
+
let(:iban_code) { "AA82WEST123456987654" }
|
417
506
|
it { is_expected.to be_nil }
|
418
507
|
|
419
|
-
it
|
508
|
+
it "does not set errors on the IBAN" do
|
420
509
|
iban.valid_length?
|
421
510
|
expect(iban.errors).to_not include(:length)
|
422
511
|
end
|
423
512
|
end
|
424
513
|
end
|
425
514
|
|
426
|
-
describe
|
515
|
+
describe "#valid_bank_code_length?" do
|
427
516
|
subject { iban.valid_bank_code_length? }
|
428
517
|
|
429
|
-
context
|
518
|
+
context "with valid details" do
|
430
519
|
it { is_expected.to eq(true) }
|
431
520
|
end
|
432
521
|
|
433
|
-
context
|
434
|
-
before { allow(iban).to receive(:swift_bank_code).and_return(
|
522
|
+
context "with invalid details" do
|
523
|
+
before { allow(iban).to receive(:swift_bank_code).and_return("WES") }
|
435
524
|
it { is_expected.to eq(false) }
|
436
525
|
|
437
|
-
context
|
438
|
-
it
|
526
|
+
context "locale en", locale: :en do
|
527
|
+
it "sets errors on the IBAN" do
|
439
528
|
iban.valid_bank_code_length?
|
440
529
|
expect(iban.errors).
|
441
|
-
to include(bank_code:
|
442
|
-
|
530
|
+
to include(bank_code: "is the wrong length (should be 4 " \
|
531
|
+
"characters)")
|
443
532
|
end
|
444
533
|
end
|
445
534
|
|
446
|
-
context
|
447
|
-
it
|
535
|
+
context "locale fr", locale: :fr do
|
536
|
+
it "sets errors on the IBAN" do
|
448
537
|
iban.valid_bank_code_length?
|
449
538
|
expect(iban.errors).
|
450
539
|
to include(bank_code: "n'a pas la bonne longueur (doit avoir 4 " \
|
451
|
-
|
540
|
+
"caractères)")
|
452
541
|
end
|
453
542
|
end
|
454
543
|
|
455
|
-
context
|
456
|
-
it
|
544
|
+
context "locale de", locale: :de do
|
545
|
+
it "sets errors on the IBAN" do
|
457
546
|
iban.valid_bank_code_length?
|
458
547
|
expect(iban.errors).
|
459
|
-
to include(bank_code:
|
460
|
-
|
548
|
+
to include(bank_code: "hat die falsche Länge (muss genau 4 " \
|
549
|
+
"Zeichen haben)")
|
461
550
|
end
|
462
551
|
end
|
463
552
|
|
464
|
-
context
|
465
|
-
it
|
553
|
+
context "locale pt", locale: :pt do
|
554
|
+
it "sets errors on the IBAN" do
|
466
555
|
iban.valid_bank_code_length?
|
467
556
|
expect(iban.errors).
|
468
|
-
to include(bank_code:
|
469
|
-
|
557
|
+
to include(bank_code: "tem o tamanho errado (deve ter 4 " \
|
558
|
+
"caracteres)")
|
470
559
|
end
|
471
560
|
end
|
472
561
|
|
473
|
-
context
|
474
|
-
it
|
562
|
+
context "locale es", locale: :es do
|
563
|
+
it "sets errors on the IBAN" do
|
475
564
|
iban.valid_bank_code_length?
|
476
565
|
expect(iban.errors).
|
477
|
-
to include(bank_code:
|
478
|
-
|
566
|
+
to include(bank_code: "tiene la longitud equivocada (debería " \
|
567
|
+
"formarse de 4 símbolos)")
|
479
568
|
end
|
480
569
|
end
|
481
570
|
|
482
|
-
context
|
483
|
-
it
|
571
|
+
context "locale it", locale: :it do
|
572
|
+
it "sets errors on the IBAN" do
|
484
573
|
iban.valid_bank_code_length?
|
485
574
|
expect(iban.errors).
|
486
|
-
to include(bank_code:
|
487
|
-
|
575
|
+
to include(bank_code: "è della lunghezza sbagliata (dovrebbe " \
|
576
|
+
"essere di 4 caratteri)")
|
488
577
|
end
|
489
578
|
end
|
490
579
|
|
491
|
-
context
|
492
|
-
it
|
580
|
+
context "locale nl", locale: :nl do
|
581
|
+
it "sets errors on the IBAN" do
|
493
582
|
iban.valid_bank_code_length?
|
494
583
|
expect(iban.errors).
|
495
|
-
to include(bank_code:
|
496
|
-
|
584
|
+
to include(bank_code: "heeft onjuiste lengte (moet 4 tekens " \
|
585
|
+
"lang zijn)")
|
497
586
|
end
|
498
587
|
end
|
499
588
|
end
|
500
589
|
|
501
|
-
context
|
502
|
-
before { allow(iban).to receive(:country_code).and_return(
|
590
|
+
context "with an invalid country_code" do
|
591
|
+
before { allow(iban).to receive(:country_code).and_return("AA") }
|
503
592
|
it { is_expected.to be_nil }
|
504
593
|
|
505
|
-
it
|
594
|
+
it "does not set errors on the IBAN" do
|
506
595
|
iban.valid_bank_code_length?
|
507
596
|
expect(iban.errors).to_not include(:bank_code)
|
508
597
|
end
|
509
598
|
end
|
510
599
|
end
|
511
600
|
|
512
|
-
describe
|
601
|
+
describe "#valid_branch_code_length?" do
|
513
602
|
subject { iban.valid_branch_code_length? }
|
514
603
|
|
515
|
-
context
|
604
|
+
context "with valid details" do
|
516
605
|
it { is_expected.to eq(true) }
|
517
606
|
end
|
518
607
|
|
519
|
-
context
|
520
|
-
before { allow(iban).to receive(:swift_branch_code).and_return(
|
608
|
+
context "with invalid details" do
|
609
|
+
before { allow(iban).to receive(:swift_branch_code).and_return("12345") }
|
521
610
|
it { is_expected.to eq(false) }
|
522
611
|
|
523
|
-
context
|
524
|
-
it
|
612
|
+
context "locale en", locale: :en do
|
613
|
+
it "sets errors on the IBAN" do
|
525
614
|
iban.valid_branch_code_length?
|
526
615
|
expect(iban.errors).
|
527
|
-
to include(branch_code:
|
528
|
-
|
616
|
+
to include(branch_code: "is the wrong length (should be 6 " \
|
617
|
+
"characters)")
|
529
618
|
end
|
530
619
|
end
|
531
620
|
|
532
|
-
context
|
533
|
-
it
|
621
|
+
context "locale fr", locale: :fr do
|
622
|
+
it "sets errors on the IBAN" do
|
534
623
|
iban.valid_branch_code_length?
|
535
624
|
expect(iban.errors).
|
536
625
|
to include(branch_code: "n'a pas la bonne longueur (doit avoir 6 " \
|
537
|
-
|
626
|
+
"caractères)")
|
538
627
|
end
|
539
628
|
end
|
540
629
|
|
541
|
-
context
|
542
|
-
it
|
630
|
+
context "locale de", locale: :de do
|
631
|
+
it "sets errors on the IBAN" do
|
543
632
|
iban.valid_branch_code_length?
|
544
633
|
expect(iban.errors).
|
545
|
-
to include(branch_code:
|
546
|
-
|
634
|
+
to include(branch_code: "hat die falsche Länge (muss genau 6 " \
|
635
|
+
"Zeichen haben)")
|
547
636
|
end
|
548
637
|
end
|
549
638
|
|
550
|
-
context
|
551
|
-
it
|
639
|
+
context "locale pt", locale: :pt do
|
640
|
+
it "sets errors on the IBAN" do
|
552
641
|
iban.valid_branch_code_length?
|
553
642
|
expect(iban.errors).
|
554
|
-
to include(branch_code:
|
555
|
-
|
643
|
+
to include(branch_code: "tem o tamanho errado (deve ter 6 " \
|
644
|
+
"caracteres)")
|
556
645
|
end
|
557
646
|
end
|
558
647
|
|
559
|
-
context
|
560
|
-
it
|
648
|
+
context "locale es", locale: :es do
|
649
|
+
it "sets errors on the IBAN" do
|
561
650
|
iban.valid_branch_code_length?
|
562
651
|
expect(iban.errors).
|
563
|
-
to include(branch_code:
|
564
|
-
|
652
|
+
to include(branch_code: "tiene la longitud equivocada (debería " \
|
653
|
+
"formarse de 6 símbolos)")
|
565
654
|
end
|
566
655
|
end
|
567
656
|
|
568
|
-
context
|
569
|
-
it
|
657
|
+
context "locale it", locale: :it do
|
658
|
+
it "sets errors on the IBAN" do
|
570
659
|
iban.valid_branch_code_length?
|
571
660
|
expect(iban.errors).
|
572
|
-
to include(branch_code:
|
573
|
-
|
661
|
+
to include(branch_code: "è della lunghezza sbagliata (dovrebbe " \
|
662
|
+
"essere di 6 caratteri)")
|
574
663
|
end
|
575
664
|
end
|
576
665
|
|
577
|
-
context
|
578
|
-
it
|
666
|
+
context "locale nl", locale: :nl do
|
667
|
+
it "sets errors on the IBAN" do
|
579
668
|
iban.valid_branch_code_length?
|
580
669
|
expect(iban.errors).
|
581
|
-
to include(branch_code:
|
582
|
-
|
670
|
+
to include(branch_code: "heeft onjuiste lengte (moet 6 tekens " \
|
671
|
+
"lang zijn)")
|
583
672
|
end
|
584
673
|
end
|
585
674
|
end
|
586
675
|
|
587
|
-
context
|
676
|
+
context "without a branch code" do
|
588
677
|
before { allow(iban).to receive(:swift_branch_code).and_return(nil) }
|
589
678
|
it { is_expected.to eq(false) }
|
590
679
|
|
591
|
-
context
|
592
|
-
it
|
680
|
+
context "locale en", locale: :en do
|
681
|
+
it "sets errors on the IBAN" do
|
593
682
|
iban.valid_branch_code_length?
|
594
|
-
expect(iban.errors).to include(branch_code:
|
683
|
+
expect(iban.errors).to include(branch_code: "is required")
|
595
684
|
end
|
596
685
|
end
|
597
686
|
|
598
|
-
context
|
599
|
-
it
|
687
|
+
context "locale fr", locale: :fr do
|
688
|
+
it "sets errors on the IBAN" do
|
600
689
|
iban.valid_branch_code_length?
|
601
|
-
expect(iban.errors).to include(branch_code:
|
690
|
+
expect(iban.errors).to include(branch_code: "est requis")
|
602
691
|
end
|
603
692
|
end
|
604
693
|
|
605
|
-
context
|
606
|
-
it
|
694
|
+
context "locale de", locale: :de do
|
695
|
+
it "sets errors on the IBAN" do
|
607
696
|
iban.valid_branch_code_length?
|
608
|
-
expect(iban.errors).to include(branch_code:
|
697
|
+
expect(iban.errors).to include(branch_code: "muss ausgefüllt werden")
|
609
698
|
end
|
610
699
|
end
|
611
700
|
|
612
|
-
context
|
613
|
-
it
|
701
|
+
context "locale pt", locale: :pt do
|
702
|
+
it "sets errors on the IBAN" do
|
614
703
|
iban.valid_branch_code_length?
|
615
|
-
expect(iban.errors).to include(branch_code:
|
704
|
+
expect(iban.errors).to include(branch_code: "é requerido")
|
616
705
|
end
|
617
706
|
end
|
618
707
|
|
619
|
-
context
|
620
|
-
it
|
708
|
+
context "locale es", locale: :es do
|
709
|
+
it "sets errors on the IBAN" do
|
621
710
|
iban.valid_branch_code_length?
|
622
|
-
expect(iban.errors).to include(branch_code:
|
711
|
+
expect(iban.errors).to include(branch_code: "es obligatorio")
|
623
712
|
end
|
624
713
|
end
|
625
714
|
|
626
|
-
context
|
627
|
-
it
|
715
|
+
context "locale it", locale: :it do
|
716
|
+
it "sets errors on the IBAN" do
|
628
717
|
iban.valid_branch_code_length?
|
629
|
-
expect(iban.errors).to include(branch_code:
|
718
|
+
expect(iban.errors).to include(branch_code: "è obbligatorio")
|
630
719
|
end
|
631
720
|
end
|
632
721
|
|
633
|
-
context
|
634
|
-
it
|
722
|
+
context "locale nl", locale: :nl do
|
723
|
+
it "sets errors on the IBAN" do
|
635
724
|
iban.valid_branch_code_length?
|
636
|
-
expect(iban.errors).to include(branch_code:
|
725
|
+
expect(iban.errors).to include(branch_code: "moet opgegeven zijn")
|
637
726
|
end
|
638
727
|
end
|
639
728
|
end
|
640
729
|
|
641
|
-
context
|
642
|
-
before { allow(iban).to receive(:country_code).and_return(
|
730
|
+
context "with an invalid country_code" do
|
731
|
+
before { allow(iban).to receive(:country_code).and_return("AA") }
|
643
732
|
it { is_expected.to be_nil }
|
644
733
|
|
645
|
-
it
|
734
|
+
it "does not set errors on the IBAN" do
|
646
735
|
iban.valid_branch_code_length?
|
647
736
|
expect(iban.errors).to_not include(:branch_code)
|
648
737
|
end
|
649
738
|
end
|
650
739
|
end
|
651
740
|
|
652
|
-
describe
|
741
|
+
describe "#valid_account_number_length?" do
|
653
742
|
subject { iban.valid_account_number_length? }
|
654
743
|
|
655
|
-
context
|
744
|
+
context "with valid details" do
|
656
745
|
it { is_expected.to eq(true) }
|
657
746
|
end
|
658
747
|
|
659
|
-
context
|
748
|
+
context "with an invalid account_number" do
|
660
749
|
before do
|
661
|
-
allow(iban).to receive(:swift_account_number).and_return(
|
750
|
+
allow(iban).to receive(:swift_account_number).and_return("1234567")
|
662
751
|
end
|
663
752
|
it { is_expected.to eq(false) }
|
664
753
|
|
665
|
-
context
|
666
|
-
it
|
754
|
+
context "locale en", locale: :en do
|
755
|
+
it "sets errors on the IBAN" do
|
667
756
|
iban.valid_account_number_length?
|
668
757
|
expect(iban.errors).
|
669
|
-
to include(account_number:
|
670
|
-
|
758
|
+
to include(account_number: "is the wrong length (should be 8 " \
|
759
|
+
"characters)")
|
671
760
|
end
|
672
761
|
end
|
673
762
|
|
674
|
-
context
|
675
|
-
it
|
763
|
+
context "locale fr", locale: :fr do
|
764
|
+
it "sets errors on the IBAN" do
|
676
765
|
iban.valid_account_number_length?
|
677
766
|
expect(iban.errors).
|
678
767
|
to include(account_number: "n'a pas la bonne longueur (doit " \
|
679
|
-
|
768
|
+
"avoir 8 caractères)")
|
680
769
|
end
|
681
770
|
end
|
682
771
|
|
683
|
-
context
|
684
|
-
it
|
772
|
+
context "locale de", locale: :de do
|
773
|
+
it "sets errors on the IBAN" do
|
685
774
|
iban.valid_account_number_length?
|
686
775
|
expect(iban.errors).
|
687
|
-
to include(account_number:
|
688
|
-
|
776
|
+
to include(account_number: "hat die falsche Länge (muss genau " \
|
777
|
+
"8 Zeichen haben)")
|
689
778
|
end
|
690
779
|
end
|
691
780
|
|
692
|
-
context
|
693
|
-
it
|
781
|
+
context "locale pt", locale: :pt do
|
782
|
+
it "sets errors on the IBAN" do
|
694
783
|
iban.valid_account_number_length?
|
695
784
|
expect(iban.errors).
|
696
|
-
to include(account_number:
|
697
|
-
|
785
|
+
to include(account_number: "tem o tamanho errado (deve ter 8 " \
|
786
|
+
"caracteres)")
|
698
787
|
end
|
699
788
|
end
|
700
789
|
|
701
|
-
context
|
702
|
-
it
|
790
|
+
context "locale es", locale: :es do
|
791
|
+
it "sets errors on the IBAN" do
|
703
792
|
iban.valid_account_number_length?
|
704
793
|
expect(iban.errors).
|
705
|
-
to include(account_number:
|
706
|
-
|
794
|
+
to include(account_number: "tiene la longitud equivocada " \
|
795
|
+
"(debería formarse de 8 símbolos)")
|
707
796
|
end
|
708
797
|
end
|
709
798
|
|
710
|
-
context
|
711
|
-
it
|
799
|
+
context "locale it", locale: :it do
|
800
|
+
it "sets errors on the IBAN" do
|
712
801
|
iban.valid_account_number_length?
|
713
802
|
expect(iban.errors).
|
714
|
-
to include(account_number:
|
715
|
-
|
803
|
+
to include(account_number: "è della lunghezza sbagliata " \
|
804
|
+
"(dovrebbe essere di 8 caratteri)")
|
716
805
|
end
|
717
806
|
end
|
718
807
|
|
719
|
-
context
|
720
|
-
it
|
808
|
+
context "locale nl", locale: :nl do
|
809
|
+
it "sets errors on the IBAN" do
|
721
810
|
iban.valid_account_number_length?
|
722
811
|
expect(iban.errors).
|
723
|
-
to include(account_number:
|
724
|
-
|
812
|
+
to include(account_number: "heeft onjuiste lengte (moet 8 " \
|
813
|
+
"tekens lang zijn)")
|
725
814
|
end
|
726
815
|
end
|
727
816
|
end
|
728
817
|
|
729
|
-
context
|
730
|
-
before { allow(iban).to receive(:country_code).and_return(
|
818
|
+
context "with an invalid country_code" do
|
819
|
+
before { allow(iban).to receive(:country_code).and_return("AA") }
|
731
820
|
it { is_expected.to be_nil }
|
732
821
|
|
733
|
-
it
|
822
|
+
it "does not set errors on the IBAN" do
|
734
823
|
iban.valid_account_number_length?
|
735
824
|
expect(iban.errors).to_not include(:account_number)
|
736
825
|
end
|
737
826
|
end
|
738
827
|
end
|
739
828
|
|
740
|
-
describe
|
829
|
+
describe "#valid_characters?" do
|
741
830
|
subject { iban.valid_characters? }
|
742
831
|
|
743
|
-
context
|
744
|
-
let(:iban_code) {
|
832
|
+
context "with valid details" do
|
833
|
+
let(:iban_code) { "GB82WEST12345698765432" }
|
745
834
|
it { is_expected.to eq(true) }
|
746
835
|
end
|
747
836
|
|
748
|
-
context
|
749
|
-
let(:iban_code) {
|
837
|
+
context "with invalid details" do
|
838
|
+
let(:iban_code) { "GB-123ABCD" }
|
750
839
|
it { is_expected.to eq(false) }
|
751
840
|
|
752
|
-
context
|
753
|
-
it
|
841
|
+
context "locale en", locale: :en do
|
842
|
+
it "sets errors on the IBAN" do
|
754
843
|
iban.valid_characters?
|
755
844
|
expect(iban.errors).
|
756
|
-
to include(characters:
|
845
|
+
to include(characters: "Non-alphanumeric characters found: -")
|
757
846
|
end
|
758
847
|
end
|
759
848
|
|
760
|
-
context
|
761
|
-
it
|
849
|
+
context "locale fr", locale: :fr do
|
850
|
+
it "sets errors on the IBAN" do
|
762
851
|
iban.valid_characters?
|
763
852
|
expect(iban.errors).
|
764
|
-
to include(characters:
|
765
|
-
|
853
|
+
to include(characters: "Caractères non alphanumériques présents " \
|
854
|
+
": -")
|
766
855
|
end
|
767
856
|
end
|
768
857
|
|
769
|
-
context
|
770
|
-
it
|
858
|
+
context "locale de", locale: :de do
|
859
|
+
it "sets errors on the IBAN" do
|
771
860
|
iban.valid_characters?
|
772
861
|
expect(iban.errors).
|
773
|
-
to include(characters:
|
862
|
+
to include(characters: "Nicht-alphanumerische Zeichen gefunden: -")
|
774
863
|
end
|
775
864
|
end
|
776
865
|
|
777
|
-
context
|
778
|
-
it
|
866
|
+
context "locale pt", locale: :pt do
|
867
|
+
it "sets errors on the IBAN" do
|
779
868
|
iban.valid_characters?
|
780
869
|
expect(iban.errors).
|
781
|
-
to include(characters:
|
782
|
-
|
870
|
+
to include(characters: "Caracteres não alfanuméricos " \
|
871
|
+
"encontrados: -")
|
783
872
|
end
|
784
873
|
end
|
785
874
|
|
786
|
-
context
|
787
|
-
it
|
875
|
+
context "locale es", locale: :es do
|
876
|
+
it "sets errors on the IBAN" do
|
788
877
|
iban.valid_characters?
|
789
878
|
expect(iban.errors).
|
790
|
-
to include(characters:
|
791
|
-
|
879
|
+
to include(characters: "Se han econtrado símbolos no " \
|
880
|
+
"alfanuméricos: -")
|
792
881
|
end
|
793
882
|
end
|
794
883
|
|
795
|
-
context
|
796
|
-
it
|
884
|
+
context "locale it", locale: :it do
|
885
|
+
it "sets errors on the IBAN" do
|
797
886
|
iban.valid_characters?
|
798
887
|
expect(iban.errors).
|
799
|
-
to include(characters:
|
800
|
-
|
888
|
+
to include(characters: "Un carattere non-alfanumerico è stato " \
|
889
|
+
"trovato: -")
|
801
890
|
end
|
802
891
|
end
|
803
892
|
|
804
|
-
context
|
805
|
-
it
|
893
|
+
context "locale nl", locale: :nl do
|
894
|
+
it "sets errors on the IBAN" do
|
806
895
|
iban.valid_characters?
|
807
896
|
expect(iban.errors).
|
808
|
-
to include(characters:
|
897
|
+
to include(characters: "Niet-alfanumerieke tekens gevonden: -")
|
809
898
|
end
|
810
899
|
end
|
811
900
|
end
|
812
901
|
end
|
813
902
|
|
814
|
-
describe
|
903
|
+
describe "#valid_format?" do
|
815
904
|
subject { iban.valid_format? }
|
816
905
|
|
817
|
-
context
|
818
|
-
let(:iban_code) {
|
906
|
+
context "with valid details" do
|
907
|
+
let(:iban_code) { "GB82WEST12345698765432" }
|
819
908
|
it { is_expected.to eq(true) }
|
820
909
|
end
|
821
910
|
|
822
|
-
context
|
823
|
-
let(:iban_code) {
|
911
|
+
context "with invalid details" do
|
912
|
+
let(:iban_code) { "GB82WEST12AAAAAA7654" }
|
824
913
|
it { is_expected.to eq(false) }
|
825
914
|
|
826
|
-
context
|
827
|
-
it
|
915
|
+
context "locale en", locale: :en do
|
916
|
+
it "sets errors on the IBAN" do
|
828
917
|
iban.valid_format?
|
829
918
|
expect(iban.errors).
|
830
|
-
to include(format:
|
919
|
+
to include(format: "Unexpected format for a GB IBAN.")
|
831
920
|
end
|
832
921
|
end
|
833
922
|
|
834
|
-
context
|
835
|
-
it
|
923
|
+
context "locale fr", locale: :fr do
|
924
|
+
it "sets errors on the IBAN" do
|
836
925
|
iban.valid_format?
|
837
926
|
expect(iban.errors).
|
838
927
|
to include(format: "Format inconnu pour l'IBAN GB.")
|
839
928
|
end
|
840
929
|
end
|
841
930
|
|
842
|
-
context
|
843
|
-
it
|
931
|
+
context "locale de", locale: :de do
|
932
|
+
it "sets errors on the IBAN" do
|
844
933
|
iban.valid_format?
|
845
934
|
expect(iban.errors).
|
846
|
-
to include(format:
|
935
|
+
to include(format: "Unerwartetes Format für eine GB IBAN.")
|
847
936
|
end
|
848
937
|
end
|
849
938
|
|
850
|
-
context
|
851
|
-
it
|
939
|
+
context "locale pt", locale: :pt do
|
940
|
+
it "sets errors on the IBAN" do
|
852
941
|
iban.valid_format?
|
853
942
|
expect(iban.errors).
|
854
|
-
to include(format:
|
943
|
+
to include(format: "Formato errado para um IBAN GB.")
|
855
944
|
end
|
856
945
|
end
|
857
946
|
|
858
|
-
context
|
859
|
-
it
|
947
|
+
context "locale es", locale: :es do
|
948
|
+
it "sets errors on the IBAN" do
|
860
949
|
iban.valid_format?
|
861
950
|
expect(iban.errors).
|
862
|
-
to include(format:
|
951
|
+
to include(format: "Formato inesperado para un IBAN de GB.")
|
863
952
|
end
|
864
953
|
end
|
865
954
|
|
866
|
-
context
|
867
|
-
it
|
955
|
+
context "locale it", locale: :it do
|
956
|
+
it "sets errors on the IBAN" do
|
868
957
|
iban.valid_format?
|
869
958
|
expect(iban.errors).
|
870
|
-
to include(format:
|
959
|
+
to include(format: "Formato non atteso per un IBAN GB.")
|
871
960
|
end
|
872
961
|
end
|
873
962
|
|
874
|
-
context
|
875
|
-
it
|
963
|
+
context "locale nl", locale: :nl do
|
964
|
+
it "sets errors on the IBAN" do
|
876
965
|
iban.valid_format?
|
877
966
|
expect(iban.errors).
|
878
|
-
to include(format:
|
967
|
+
to include(format: "Onverwachte formaat voor een GB IBAN.")
|
879
968
|
end
|
880
969
|
end
|
881
970
|
end
|
882
971
|
|
883
|
-
context
|
884
|
-
let(:iban_code) {
|
972
|
+
context "with an invalid country_code" do
|
973
|
+
let(:iban_code) { "AA82WEST12AAAAAA7654" }
|
885
974
|
it { is_expected.to be_nil }
|
886
975
|
|
887
|
-
it
|
976
|
+
it "does not set errors on the IBAN" do
|
888
977
|
iban.valid_format?
|
889
978
|
expect(iban.errors).to_not include(:format)
|
890
979
|
end
|
891
980
|
end
|
892
981
|
end
|
893
982
|
|
894
|
-
describe
|
983
|
+
describe "#valid_bank_code_format?" do
|
895
984
|
subject { iban.valid_bank_code_format? }
|
896
985
|
|
897
|
-
context
|
986
|
+
context "GB numeric bank code" do
|
898
987
|
let(:arg) do
|
899
988
|
{
|
900
|
-
country_code:
|
901
|
-
bank_code:
|
902
|
-
branch_code:
|
903
|
-
account_number:
|
989
|
+
country_code: "GB",
|
990
|
+
bank_code: "1234",
|
991
|
+
branch_code: "200000",
|
992
|
+
account_number: "55779911",
|
904
993
|
}
|
905
994
|
end
|
906
995
|
|
907
996
|
it { is_expected.to eq(false) }
|
908
997
|
|
909
|
-
context
|
910
|
-
it
|
998
|
+
context "locale en", locale: :en do
|
999
|
+
it "sets errors on the IBAN" do
|
911
1000
|
iban.valid_bank_code_format?
|
912
|
-
expect(iban.errors).to include(bank_code:
|
1001
|
+
expect(iban.errors).to include(bank_code: "is invalid")
|
913
1002
|
end
|
914
1003
|
end
|
915
1004
|
|
916
|
-
context
|
917
|
-
it
|
1005
|
+
context "locale fr", locale: :fr do
|
1006
|
+
it "sets errors on the IBAN" do
|
918
1007
|
iban.valid_bank_code_format?
|
919
|
-
expect(iban.errors).to include(bank_code:
|
1008
|
+
expect(iban.errors).to include(bank_code: "est invalide")
|
920
1009
|
end
|
921
1010
|
end
|
922
1011
|
|
923
|
-
context
|
924
|
-
it
|
1012
|
+
context "locale de", locale: :de do
|
1013
|
+
it "sets errors on the IBAN" do
|
925
1014
|
iban.valid_bank_code_format?
|
926
|
-
expect(iban.errors).to include(bank_code:
|
1015
|
+
expect(iban.errors).to include(bank_code: "ist nicht gültig")
|
927
1016
|
end
|
928
1017
|
end
|
929
1018
|
|
930
|
-
context
|
931
|
-
it
|
1019
|
+
context "locale pt", locale: :pt do
|
1020
|
+
it "sets errors on the IBAN" do
|
932
1021
|
iban.valid_bank_code_format?
|
933
|
-
expect(iban.errors).to include(bank_code:
|
1022
|
+
expect(iban.errors).to include(bank_code: "é inválido")
|
934
1023
|
end
|
935
1024
|
end
|
936
1025
|
|
937
|
-
context
|
938
|
-
it
|
1026
|
+
context "locale es", locale: :es do
|
1027
|
+
it "sets errors on the IBAN" do
|
939
1028
|
iban.valid_bank_code_format?
|
940
|
-
expect(iban.errors).to include(bank_code:
|
1029
|
+
expect(iban.errors).to include(bank_code: "es inválido")
|
941
1030
|
end
|
942
1031
|
end
|
943
1032
|
|
944
|
-
context
|
945
|
-
it
|
1033
|
+
context "locale it", locale: :it do
|
1034
|
+
it "sets errors on the IBAN" do
|
946
1035
|
iban.valid_bank_code_format?
|
947
|
-
expect(iban.errors).to include(bank_code:
|
1036
|
+
expect(iban.errors).to include(bank_code: "non è valido")
|
948
1037
|
end
|
949
1038
|
end
|
950
1039
|
|
951
|
-
context
|
952
|
-
it
|
1040
|
+
context "locale nl", locale: :nl do
|
1041
|
+
it "sets errors on the IBAN" do
|
953
1042
|
iban.valid_bank_code_format?
|
954
|
-
expect(iban.errors).to include(bank_code:
|
1043
|
+
expect(iban.errors).to include(bank_code: "is ongeldig")
|
955
1044
|
end
|
956
1045
|
end
|
957
1046
|
end
|
958
1047
|
|
959
|
-
context
|
960
|
-
let(:iban_code) {
|
1048
|
+
context "with an invalid country code" do
|
1049
|
+
let(:iban_code) { "AA821234BANK121234567B" }
|
961
1050
|
|
962
1051
|
it { is_expected.to be_nil }
|
963
1052
|
end
|
964
1053
|
|
965
|
-
context
|
1054
|
+
context "with a wrong-length bank code" do
|
966
1055
|
let(:arg) do
|
967
1056
|
{
|
968
|
-
country_code:
|
969
|
-
bank_code:
|
970
|
-
branch_code:
|
971
|
-
account_number:
|
1057
|
+
country_code: "FR",
|
1058
|
+
bank_code: "1234",
|
1059
|
+
branch_code: "12345",
|
1060
|
+
account_number: "123456789123",
|
972
1061
|
}
|
973
1062
|
end
|
974
1063
|
|
@@ -976,84 +1065,84 @@ describe Ibandit::IBAN do
|
|
976
1065
|
end
|
977
1066
|
end
|
978
1067
|
|
979
|
-
describe
|
1068
|
+
describe "#valid_branch_code_format?" do
|
980
1069
|
subject { iban.valid_branch_code_format? }
|
981
1070
|
|
982
|
-
context
|
1071
|
+
context "IT non-numeric branch code" do
|
983
1072
|
let(:arg) do
|
984
1073
|
{
|
985
|
-
country_code:
|
986
|
-
bank_code:
|
987
|
-
branch_code:
|
988
|
-
account_number:
|
1074
|
+
country_code: "IT",
|
1075
|
+
bank_code: "12345",
|
1076
|
+
branch_code: "ABCDE",
|
1077
|
+
account_number: "123456789012",
|
989
1078
|
}
|
990
1079
|
end
|
991
1080
|
|
992
1081
|
it { is_expected.to eq(false) }
|
993
1082
|
|
994
|
-
context
|
995
|
-
it
|
1083
|
+
context "locale en", locale: :en do
|
1084
|
+
it "sets errors on the IBAN" do
|
996
1085
|
iban.valid_branch_code_format?
|
997
|
-
expect(iban.errors).to include(branch_code:
|
1086
|
+
expect(iban.errors).to include(branch_code: "is invalid")
|
998
1087
|
end
|
999
1088
|
end
|
1000
1089
|
|
1001
|
-
context
|
1002
|
-
it
|
1090
|
+
context "locale fr", locale: :fr do
|
1091
|
+
it "sets errors on the IBAN" do
|
1003
1092
|
iban.valid_branch_code_format?
|
1004
|
-
expect(iban.errors).to include(branch_code:
|
1093
|
+
expect(iban.errors).to include(branch_code: "est invalide")
|
1005
1094
|
end
|
1006
1095
|
end
|
1007
1096
|
|
1008
|
-
context
|
1009
|
-
it
|
1097
|
+
context "locale de", locale: :de do
|
1098
|
+
it "sets errors on the IBAN" do
|
1010
1099
|
iban.valid_branch_code_format?
|
1011
|
-
expect(iban.errors).to include(branch_code:
|
1100
|
+
expect(iban.errors).to include(branch_code: "ist nicht gültig")
|
1012
1101
|
end
|
1013
1102
|
end
|
1014
1103
|
|
1015
|
-
context
|
1016
|
-
it
|
1104
|
+
context "locale pt", locale: :pt do
|
1105
|
+
it "sets errors on the IBAN" do
|
1017
1106
|
iban.valid_branch_code_format?
|
1018
|
-
expect(iban.errors).to include(branch_code:
|
1107
|
+
expect(iban.errors).to include(branch_code: "é inválido")
|
1019
1108
|
end
|
1020
1109
|
end
|
1021
1110
|
|
1022
|
-
context
|
1023
|
-
it
|
1111
|
+
context "locale es", locale: :es do
|
1112
|
+
it "sets errors on the IBAN" do
|
1024
1113
|
iban.valid_branch_code_format?
|
1025
|
-
expect(iban.errors).to include(branch_code:
|
1114
|
+
expect(iban.errors).to include(branch_code: "es inválido")
|
1026
1115
|
end
|
1027
1116
|
end
|
1028
1117
|
|
1029
|
-
context
|
1030
|
-
it
|
1118
|
+
context "locale it", locale: :it do
|
1119
|
+
it "sets errors on the IBAN" do
|
1031
1120
|
iban.valid_branch_code_format?
|
1032
|
-
expect(iban.errors).to include(branch_code:
|
1121
|
+
expect(iban.errors).to include(branch_code: "non è valido")
|
1033
1122
|
end
|
1034
1123
|
end
|
1035
1124
|
|
1036
|
-
context
|
1037
|
-
it
|
1125
|
+
context "locale nl", locale: :nl do
|
1126
|
+
it "sets errors on the IBAN" do
|
1038
1127
|
iban.valid_branch_code_format?
|
1039
|
-
expect(iban.errors).to include(branch_code:
|
1128
|
+
expect(iban.errors).to include(branch_code: "is ongeldig")
|
1040
1129
|
end
|
1041
1130
|
end
|
1042
1131
|
end
|
1043
1132
|
|
1044
|
-
context
|
1045
|
-
let(:iban_code) {
|
1133
|
+
context "with an invalid country code" do
|
1134
|
+
let(:iban_code) { "AA821234BANK121234567B" }
|
1046
1135
|
|
1047
1136
|
it { is_expected.to be_nil }
|
1048
1137
|
end
|
1049
1138
|
|
1050
|
-
context
|
1139
|
+
context "with a wrong-length branch code" do
|
1051
1140
|
let(:arg) do
|
1052
1141
|
{
|
1053
|
-
country_code:
|
1054
|
-
bank_code:
|
1055
|
-
branch_code:
|
1056
|
-
account_number:
|
1142
|
+
country_code: "PT",
|
1143
|
+
bank_code: "1234",
|
1144
|
+
branch_code: "ABC",
|
1145
|
+
account_number: "123456789123",
|
1057
1146
|
}
|
1058
1147
|
end
|
1059
1148
|
|
@@ -1061,82 +1150,82 @@ describe Ibandit::IBAN do
|
|
1061
1150
|
end
|
1062
1151
|
end
|
1063
1152
|
|
1064
|
-
describe
|
1153
|
+
describe "#valid_account_number_format?" do
|
1065
1154
|
subject { iban.valid_account_number_format? }
|
1066
1155
|
|
1067
|
-
context
|
1156
|
+
context "DE non-numeric account number" do
|
1068
1157
|
let(:arg) do
|
1069
1158
|
{
|
1070
|
-
country_code:
|
1071
|
-
bank_code:
|
1072
|
-
account_number:
|
1159
|
+
country_code: "DE",
|
1160
|
+
bank_code: "12345678",
|
1161
|
+
account_number: "55779911AA",
|
1073
1162
|
}
|
1074
1163
|
end
|
1075
1164
|
|
1076
1165
|
it { is_expected.to eq(false) }
|
1077
1166
|
|
1078
|
-
context
|
1079
|
-
it
|
1167
|
+
context "locale en", locale: :en do
|
1168
|
+
it "sets errors on the IBAN" do
|
1080
1169
|
iban.valid_account_number_format?
|
1081
|
-
expect(iban.errors).to include(account_number:
|
1170
|
+
expect(iban.errors).to include(account_number: "is invalid")
|
1082
1171
|
end
|
1083
1172
|
end
|
1084
1173
|
|
1085
|
-
context
|
1086
|
-
it
|
1174
|
+
context "locale fr", locale: :fr do
|
1175
|
+
it "sets errors on the IBAN" do
|
1087
1176
|
iban.valid_account_number_format?
|
1088
|
-
expect(iban.errors).to include(account_number:
|
1177
|
+
expect(iban.errors).to include(account_number: "est invalide")
|
1089
1178
|
end
|
1090
1179
|
end
|
1091
1180
|
|
1092
|
-
context
|
1093
|
-
it
|
1181
|
+
context "locale de", locale: :de do
|
1182
|
+
it "sets errors on the IBAN" do
|
1094
1183
|
iban.valid_account_number_format?
|
1095
|
-
expect(iban.errors).to include(account_number:
|
1184
|
+
expect(iban.errors).to include(account_number: "ist nicht gültig")
|
1096
1185
|
end
|
1097
1186
|
end
|
1098
1187
|
|
1099
|
-
context
|
1100
|
-
it
|
1188
|
+
context "locale pt", locale: :pt do
|
1189
|
+
it "sets errors on the IBAN" do
|
1101
1190
|
iban.valid_account_number_format?
|
1102
|
-
expect(iban.errors).to include(account_number:
|
1191
|
+
expect(iban.errors).to include(account_number: "é inválido")
|
1103
1192
|
end
|
1104
1193
|
end
|
1105
1194
|
|
1106
|
-
context
|
1107
|
-
it
|
1195
|
+
context "locale es", locale: :es do
|
1196
|
+
it "sets errors on the IBAN" do
|
1108
1197
|
iban.valid_account_number_format?
|
1109
|
-
expect(iban.errors).to include(account_number:
|
1198
|
+
expect(iban.errors).to include(account_number: "es inválido")
|
1110
1199
|
end
|
1111
1200
|
end
|
1112
1201
|
|
1113
|
-
context
|
1114
|
-
it
|
1202
|
+
context "locale it", locale: :it do
|
1203
|
+
it "sets errors on the IBAN" do
|
1115
1204
|
iban.valid_account_number_format?
|
1116
|
-
expect(iban.errors).to include(account_number:
|
1205
|
+
expect(iban.errors).to include(account_number: "non è valido")
|
1117
1206
|
end
|
1118
1207
|
end
|
1119
1208
|
|
1120
|
-
context
|
1121
|
-
it
|
1209
|
+
context "locale nl", locale: :nl do
|
1210
|
+
it "sets errors on the IBAN" do
|
1122
1211
|
iban.valid_account_number_format?
|
1123
|
-
expect(iban.errors).to include(account_number:
|
1212
|
+
expect(iban.errors).to include(account_number: "is ongeldig")
|
1124
1213
|
end
|
1125
1214
|
end
|
1126
1215
|
end
|
1127
1216
|
|
1128
|
-
context
|
1129
|
-
let(:iban_code) {
|
1217
|
+
context "with an invalid country code" do
|
1218
|
+
let(:iban_code) { "AA821234BANK121234567B" }
|
1130
1219
|
|
1131
1220
|
it { is_expected.to be_nil }
|
1132
1221
|
end
|
1133
1222
|
|
1134
|
-
context
|
1223
|
+
context "with a wrong-length account number" do
|
1135
1224
|
let(:arg) do
|
1136
1225
|
{
|
1137
|
-
country_code:
|
1138
|
-
bank_code:
|
1139
|
-
account_number: nil
|
1226
|
+
country_code: "NL",
|
1227
|
+
bank_code: "ABCD",
|
1228
|
+
account_number: nil,
|
1140
1229
|
}
|
1141
1230
|
end
|
1142
1231
|
|
@@ -1144,30 +1233,31 @@ describe Ibandit::IBAN do
|
|
1144
1233
|
end
|
1145
1234
|
end
|
1146
1235
|
|
1147
|
-
describe
|
1236
|
+
describe "#valid_local_modulus_check?" do
|
1148
1237
|
subject(:valid_local_modulus_check?) { iban.valid_local_modulus_check? }
|
1149
1238
|
|
1150
|
-
context
|
1239
|
+
context "without a modulus checker defined" do
|
1151
1240
|
it { is_expected.to be(true) }
|
1152
1241
|
end
|
1153
1242
|
|
1154
|
-
context
|
1243
|
+
context "with a modulus checker defined" do
|
1155
1244
|
before do
|
1156
1245
|
Ibandit.modulus_checker = double(
|
1157
1246
|
valid_bank_code?: valid_bank_code,
|
1158
1247
|
valid_branch_code?: valid_branch_code,
|
1159
|
-
valid_account_number?: valid_account_number
|
1248
|
+
valid_account_number?: valid_account_number,
|
1249
|
+
)
|
1160
1250
|
end
|
1161
1251
|
after { Ibandit.modulus_checker = nil }
|
1162
1252
|
before { iban.valid_local_modulus_check? }
|
1163
1253
|
|
1164
|
-
context
|
1165
|
-
let(:iban_code) {
|
1254
|
+
context "with an invalid bank code" do
|
1255
|
+
let(:iban_code) { "AT611904300234573201" }
|
1166
1256
|
let(:valid_bank_code) { false }
|
1167
1257
|
let(:valid_branch_code) { true }
|
1168
1258
|
let(:valid_account_number) { true }
|
1169
1259
|
|
1170
|
-
it
|
1260
|
+
it "calls valid_bank_code? with an IBAN object" do
|
1171
1261
|
expect(Ibandit.modulus_checker).
|
1172
1262
|
to receive(:valid_bank_code?).
|
1173
1263
|
with(instance_of(Ibandit::IBAN))
|
@@ -1177,47 +1267,47 @@ describe Ibandit::IBAN do
|
|
1177
1267
|
|
1178
1268
|
it { is_expected.to be(false) }
|
1179
1269
|
|
1180
|
-
context
|
1181
|
-
specify { expect(iban.errors).to include(bank_code:
|
1270
|
+
context "locale en", locale: :en do
|
1271
|
+
specify { expect(iban.errors).to include(bank_code: "is invalid") }
|
1182
1272
|
end
|
1183
1273
|
|
1184
|
-
context
|
1185
|
-
specify { expect(iban.errors).to include(bank_code:
|
1274
|
+
context "locale fr", locale: :fr do
|
1275
|
+
specify { expect(iban.errors).to include(bank_code: "est invalide") }
|
1186
1276
|
end
|
1187
1277
|
|
1188
|
-
context
|
1278
|
+
context "locale de", locale: :de do
|
1189
1279
|
specify do
|
1190
|
-
expect(iban.errors).to include(bank_code:
|
1280
|
+
expect(iban.errors).to include(bank_code: "ist nicht gültig")
|
1191
1281
|
end
|
1192
1282
|
end
|
1193
1283
|
|
1194
|
-
context
|
1195
|
-
specify { expect(iban.errors).to include(bank_code:
|
1284
|
+
context "locale pt", locale: :pt do
|
1285
|
+
specify { expect(iban.errors).to include(bank_code: "é inválido") }
|
1196
1286
|
end
|
1197
1287
|
|
1198
|
-
context
|
1199
|
-
specify { expect(iban.errors).to include(bank_code:
|
1288
|
+
context "locale es", locale: :es do
|
1289
|
+
specify { expect(iban.errors).to include(bank_code: "es inválido") }
|
1200
1290
|
end
|
1201
1291
|
|
1202
|
-
context
|
1203
|
-
specify { expect(iban.errors).to include(bank_code:
|
1292
|
+
context "locale it", locale: :it do
|
1293
|
+
specify { expect(iban.errors).to include(bank_code: "non è valido") }
|
1204
1294
|
end
|
1205
1295
|
|
1206
|
-
context
|
1207
|
-
specify { expect(iban.errors).to include(bank_code:
|
1296
|
+
context "locale nl", locale: :nl do
|
1297
|
+
specify { expect(iban.errors).to include(bank_code: "is ongeldig") }
|
1208
1298
|
end
|
1209
1299
|
end
|
1210
1300
|
|
1211
|
-
context
|
1212
|
-
let(:iban_code) {
|
1213
|
-
before { Ibandit.bic_finder = double(call:
|
1301
|
+
context "with an invalid branch code" do
|
1302
|
+
let(:iban_code) { "GB60BARC20000055779911" }
|
1303
|
+
before { Ibandit.bic_finder = double(call: "BARCGB22XXX") }
|
1214
1304
|
after { Ibandit.bic_finder = nil }
|
1215
1305
|
before { iban.valid_local_modulus_check? }
|
1216
1306
|
let(:valid_bank_code) { true }
|
1217
1307
|
let(:valid_branch_code) { false }
|
1218
1308
|
let(:valid_account_number) { true }
|
1219
1309
|
|
1220
|
-
it
|
1310
|
+
it "calls valid_branch_code? with an IBAN object" do
|
1221
1311
|
expect(Ibandit.modulus_checker).
|
1222
1312
|
to receive(:valid_branch_code?).
|
1223
1313
|
with(instance_of(Ibandit::IBAN))
|
@@ -1227,55 +1317,55 @@ describe Ibandit::IBAN do
|
|
1227
1317
|
|
1228
1318
|
it { is_expected.to be(false) }
|
1229
1319
|
|
1230
|
-
context
|
1320
|
+
context "locale en", locale: :en do
|
1231
1321
|
specify do
|
1232
|
-
expect(iban.errors).to include(branch_code:
|
1322
|
+
expect(iban.errors).to include(branch_code: "is invalid")
|
1233
1323
|
end
|
1234
1324
|
end
|
1235
1325
|
|
1236
|
-
context
|
1326
|
+
context "locale fr", locale: :fr do
|
1237
1327
|
specify do
|
1238
|
-
expect(iban.errors).to include(branch_code:
|
1328
|
+
expect(iban.errors).to include(branch_code: "est invalide")
|
1239
1329
|
end
|
1240
1330
|
end
|
1241
1331
|
|
1242
|
-
context
|
1332
|
+
context "locale de", locale: :de do
|
1243
1333
|
specify do
|
1244
|
-
expect(iban.errors).to include(branch_code:
|
1334
|
+
expect(iban.errors).to include(branch_code: "ist nicht gültig")
|
1245
1335
|
end
|
1246
1336
|
end
|
1247
1337
|
|
1248
|
-
context
|
1338
|
+
context "locale pt", locale: :pt do
|
1249
1339
|
specify do
|
1250
|
-
expect(iban.errors).to include(branch_code:
|
1340
|
+
expect(iban.errors).to include(branch_code: "é inválido")
|
1251
1341
|
end
|
1252
1342
|
end
|
1253
1343
|
|
1254
|
-
context
|
1344
|
+
context "locale es", locale: :es do
|
1255
1345
|
specify do
|
1256
|
-
expect(iban.errors).to include(branch_code:
|
1346
|
+
expect(iban.errors).to include(branch_code: "es inválido")
|
1257
1347
|
end
|
1258
1348
|
end
|
1259
1349
|
|
1260
|
-
context
|
1350
|
+
context "locale it", locale: :it do
|
1261
1351
|
specify do
|
1262
|
-
expect(iban.errors).to include(branch_code:
|
1352
|
+
expect(iban.errors).to include(branch_code: "non è valido")
|
1263
1353
|
end
|
1264
1354
|
end
|
1265
1355
|
|
1266
|
-
context
|
1356
|
+
context "locale nl", locale: :nl do
|
1267
1357
|
specify do
|
1268
|
-
expect(iban.errors).to include(branch_code:
|
1358
|
+
expect(iban.errors).to include(branch_code: "is ongeldig")
|
1269
1359
|
end
|
1270
1360
|
end
|
1271
1361
|
end
|
1272
1362
|
|
1273
|
-
context
|
1363
|
+
context "with an invalid account number" do
|
1274
1364
|
let(:valid_bank_code) { true }
|
1275
1365
|
let(:valid_branch_code) { true }
|
1276
1366
|
let(:valid_account_number) { false }
|
1277
1367
|
|
1278
|
-
it
|
1368
|
+
it "calls valid_account_number? with an IBAN object" do
|
1279
1369
|
expect(Ibandit.modulus_checker).
|
1280
1370
|
to receive(:valid_account_number?).
|
1281
1371
|
with(instance_of(Ibandit::IBAN))
|
@@ -1285,141 +1375,141 @@ describe Ibandit::IBAN do
|
|
1285
1375
|
|
1286
1376
|
it { is_expected.to be(false) }
|
1287
1377
|
|
1288
|
-
context
|
1378
|
+
context "locale en", locale: :en do
|
1289
1379
|
specify do
|
1290
|
-
expect(iban.errors).to include(account_number:
|
1380
|
+
expect(iban.errors).to include(account_number: "is invalid")
|
1291
1381
|
end
|
1292
1382
|
end
|
1293
1383
|
|
1294
|
-
context
|
1384
|
+
context "locale fr", locale: :fr do
|
1295
1385
|
specify do
|
1296
|
-
expect(iban.errors).to include(account_number:
|
1386
|
+
expect(iban.errors).to include(account_number: "est invalide")
|
1297
1387
|
end
|
1298
1388
|
end
|
1299
1389
|
|
1300
|
-
context
|
1390
|
+
context "locale de", locale: :de do
|
1301
1391
|
specify do
|
1302
|
-
expect(iban.errors).to include(account_number:
|
1392
|
+
expect(iban.errors).to include(account_number: "ist nicht gültig")
|
1303
1393
|
end
|
1304
1394
|
end
|
1305
1395
|
|
1306
|
-
context
|
1396
|
+
context "locale pt", locale: :pt do
|
1307
1397
|
specify do
|
1308
|
-
expect(iban.errors).to include(account_number:
|
1398
|
+
expect(iban.errors).to include(account_number: "é inválido")
|
1309
1399
|
end
|
1310
1400
|
end
|
1311
1401
|
|
1312
|
-
context
|
1402
|
+
context "locale es", locale: :es do
|
1313
1403
|
specify do
|
1314
|
-
expect(iban.errors).to include(account_number:
|
1404
|
+
expect(iban.errors).to include(account_number: "es inválido")
|
1315
1405
|
end
|
1316
1406
|
end
|
1317
1407
|
|
1318
|
-
context
|
1408
|
+
context "locale it", locale: :it do
|
1319
1409
|
specify do
|
1320
|
-
expect(iban.errors).to include(account_number:
|
1410
|
+
expect(iban.errors).to include(account_number: "non è valido")
|
1321
1411
|
end
|
1322
1412
|
end
|
1323
1413
|
|
1324
|
-
context
|
1414
|
+
context "locale nl", locale: :nl do
|
1325
1415
|
specify do
|
1326
|
-
expect(iban.errors).to include(account_number:
|
1416
|
+
expect(iban.errors).to include(account_number: "is ongeldig")
|
1327
1417
|
end
|
1328
1418
|
end
|
1329
1419
|
end
|
1330
1420
|
end
|
1331
1421
|
|
1332
|
-
describe
|
1422
|
+
describe "supports_iban_determination?" do
|
1333
1423
|
subject { iban.supports_iban_determination? }
|
1334
1424
|
|
1335
|
-
context
|
1425
|
+
context "with unsupported account details" do
|
1336
1426
|
let(:arg) do
|
1337
1427
|
{
|
1338
|
-
country_code:
|
1339
|
-
bank_code:
|
1340
|
-
account_number:
|
1428
|
+
country_code: "DE",
|
1429
|
+
bank_code: "20000000",
|
1430
|
+
account_number: "7955791111",
|
1341
1431
|
}
|
1342
1432
|
end
|
1343
1433
|
|
1344
1434
|
it { is_expected.to eq(false) }
|
1345
1435
|
|
1346
|
-
context
|
1436
|
+
context "locale en", locale: :en do
|
1347
1437
|
specify do
|
1348
1438
|
iban.supports_iban_determination?
|
1349
1439
|
expect(iban.errors).
|
1350
|
-
to include(account_number:
|
1440
|
+
to include(account_number: "does not support payments")
|
1351
1441
|
end
|
1352
1442
|
end
|
1353
1443
|
|
1354
|
-
context
|
1444
|
+
context "locale fr", locale: :fr do
|
1355
1445
|
specify do
|
1356
1446
|
iban.supports_iban_determination?
|
1357
1447
|
expect(iban.errors).
|
1358
|
-
to include(account_number:
|
1448
|
+
to include(account_number: "ne supporte pas les paiements")
|
1359
1449
|
end
|
1360
1450
|
end
|
1361
1451
|
|
1362
|
-
context
|
1452
|
+
context "locale de", locale: :de do
|
1363
1453
|
specify do
|
1364
1454
|
iban.supports_iban_determination?
|
1365
1455
|
expect(iban.errors).
|
1366
|
-
to include(account_number:
|
1456
|
+
to include(account_number: "nicht Zahlungsverkehr unterstützt")
|
1367
1457
|
end
|
1368
1458
|
end
|
1369
1459
|
|
1370
|
-
context
|
1460
|
+
context "locale pt", locale: :pt do
|
1371
1461
|
specify do
|
1372
1462
|
iban.supports_iban_determination?
|
1373
1463
|
expect(iban.errors).
|
1374
|
-
to include(account_number:
|
1464
|
+
to include(account_number: "não suporta pagamentos")
|
1375
1465
|
end
|
1376
1466
|
end
|
1377
1467
|
|
1378
|
-
context
|
1468
|
+
context "locale es", locale: :es do
|
1379
1469
|
specify do
|
1380
1470
|
iban.supports_iban_determination?
|
1381
1471
|
expect(iban.errors).
|
1382
|
-
to include(account_number:
|
1472
|
+
to include(account_number: "no admite pagos")
|
1383
1473
|
end
|
1384
1474
|
end
|
1385
1475
|
|
1386
|
-
context
|
1476
|
+
context "locale it", locale: :it do
|
1387
1477
|
specify do
|
1388
1478
|
iban.supports_iban_determination?
|
1389
1479
|
expect(iban.errors).
|
1390
|
-
to include(account_number:
|
1480
|
+
to include(account_number: "non supporta pagamenti")
|
1391
1481
|
end
|
1392
1482
|
end
|
1393
1483
|
|
1394
|
-
context
|
1484
|
+
context "locale nl", locale: :nl do
|
1395
1485
|
specify do
|
1396
1486
|
iban.supports_iban_determination?
|
1397
1487
|
expect(iban.errors).
|
1398
|
-
to include(account_number:
|
1488
|
+
to include(account_number: "ondersteunt geen betalingen")
|
1399
1489
|
end
|
1400
1490
|
end
|
1401
1491
|
end
|
1402
1492
|
end
|
1403
1493
|
|
1404
|
-
describe
|
1494
|
+
describe "valid_swedish_details?" do
|
1405
1495
|
subject { iban.valid_swedish_details? }
|
1406
1496
|
|
1407
|
-
context
|
1408
|
-
context
|
1497
|
+
context "with SWIFT details" do
|
1498
|
+
context "with an account number that is too long" do
|
1409
1499
|
let(:arg) do
|
1410
1500
|
{
|
1411
|
-
country_code:
|
1412
|
-
bank_code:
|
1413
|
-
account_number:
|
1501
|
+
country_code: "SE",
|
1502
|
+
bank_code: "500",
|
1503
|
+
account_number: "00000543910240391",
|
1414
1504
|
}
|
1415
1505
|
end
|
1416
1506
|
|
1417
1507
|
it { is_expected.to eq(false) }
|
1418
1508
|
|
1419
|
-
context
|
1509
|
+
context "locale en", locale: :en do
|
1420
1510
|
specify do
|
1421
1511
|
iban.valid_swedish_details?
|
1422
|
-
expect(iban.errors).to eq(account_number:
|
1512
|
+
expect(iban.errors).to eq(account_number: "is invalid")
|
1423
1513
|
end
|
1424
1514
|
end
|
1425
1515
|
end
|
@@ -1427,89 +1517,89 @@ describe Ibandit::IBAN do
|
|
1427
1517
|
context "with an account number that doesn't have a bank code" do
|
1428
1518
|
let(:arg) do
|
1429
1519
|
{
|
1430
|
-
country_code:
|
1520
|
+
country_code: "SE",
|
1431
1521
|
bank_code: nil,
|
1432
|
-
account_number:
|
1522
|
+
account_number: "00000000000010011",
|
1433
1523
|
}
|
1434
1524
|
end
|
1435
1525
|
|
1436
1526
|
it { is_expected.to eq(false) }
|
1437
1527
|
|
1438
|
-
context
|
1528
|
+
context "locale en", locale: :en do
|
1439
1529
|
specify do
|
1440
1530
|
iban.valid?
|
1441
|
-
expect(iban.errors).to include(account_number:
|
1531
|
+
expect(iban.errors).to include(account_number: "is invalid")
|
1442
1532
|
expect(iban.errors).to_not include(:bank_code)
|
1443
1533
|
end
|
1444
1534
|
end
|
1445
1535
|
end
|
1446
1536
|
|
1447
|
-
context
|
1537
|
+
context "with a bank code that does not match" do
|
1448
1538
|
let(:arg) do
|
1449
1539
|
{
|
1450
|
-
country_code:
|
1451
|
-
bank_code:
|
1452
|
-
account_number:
|
1540
|
+
country_code: "SE",
|
1541
|
+
bank_code: "902",
|
1542
|
+
account_number: "00000054391024039",
|
1453
1543
|
}
|
1454
1544
|
end
|
1455
1545
|
|
1456
1546
|
it { is_expected.to eq(false) }
|
1457
1547
|
|
1458
|
-
context
|
1548
|
+
context "locale en", locale: :en do
|
1459
1549
|
specify do
|
1460
1550
|
iban.valid_swedish_details?
|
1461
|
-
expect(iban.errors).to eq(account_number:
|
1551
|
+
expect(iban.errors).to eq(account_number: "is invalid")
|
1462
1552
|
end
|
1463
1553
|
end
|
1464
1554
|
end
|
1465
1555
|
end
|
1466
1556
|
|
1467
|
-
context
|
1468
|
-
context
|
1557
|
+
context "with local details" do
|
1558
|
+
context "with good details" do
|
1469
1559
|
let(:arg) do
|
1470
1560
|
{
|
1471
|
-
country_code:
|
1472
|
-
account_number:
|
1561
|
+
country_code: "SE",
|
1562
|
+
account_number: "5439-0240391",
|
1473
1563
|
}
|
1474
1564
|
end
|
1475
1565
|
|
1476
1566
|
it { is_expected.to eq(true) }
|
1477
1567
|
end
|
1478
1568
|
|
1479
|
-
context
|
1569
|
+
context "with a clearing code that is too long" do
|
1480
1570
|
let(:arg) do
|
1481
1571
|
{
|
1482
|
-
country_code:
|
1483
|
-
branch_code:
|
1484
|
-
account_number:
|
1572
|
+
country_code: "SE",
|
1573
|
+
branch_code: "54391",
|
1574
|
+
account_number: "0240391",
|
1485
1575
|
}
|
1486
1576
|
end
|
1487
1577
|
|
1488
1578
|
it { is_expected.to eq(false) }
|
1489
1579
|
|
1490
|
-
context
|
1580
|
+
context "locale en", locale: :en do
|
1491
1581
|
specify do
|
1492
1582
|
iban.valid_swedish_details?
|
1493
|
-
expect(iban.errors).to eq(branch_code:
|
1583
|
+
expect(iban.errors).to eq(branch_code: "is invalid")
|
1494
1584
|
end
|
1495
1585
|
end
|
1496
1586
|
end
|
1497
1587
|
|
1498
|
-
context
|
1588
|
+
context "with a serial number that is too long" do
|
1499
1589
|
let(:arg) do
|
1500
1590
|
{
|
1501
|
-
country_code:
|
1502
|
-
branch_code:
|
1503
|
-
account_number:
|
1591
|
+
country_code: "SE",
|
1592
|
+
branch_code: "5439",
|
1593
|
+
account_number: "024039111",
|
1504
1594
|
}
|
1505
1595
|
end
|
1506
1596
|
|
1507
1597
|
it { is_expected.to eq(false) }
|
1508
1598
|
|
1509
|
-
context
|
1599
|
+
context "locale en", locale: :en do
|
1510
1600
|
specify do
|
1511
1601
|
iban.valid_swedish_details?
|
1512
|
-
expect(iban.errors).to eq(account_number:
|
1602
|
+
expect(iban.errors).to eq(account_number: "is invalid")
|
1513
1603
|
end
|
1514
1604
|
end
|
1515
1605
|
end
|
@@ -1517,8 +1607,8 @@ describe Ibandit::IBAN do
|
|
1517
1607
|
end
|
1518
1608
|
end
|
1519
1609
|
|
1520
|
-
describe
|
1521
|
-
describe
|
1610
|
+
describe "#valid?" do
|
1611
|
+
describe "validations called" do
|
1522
1612
|
after { iban.valid? }
|
1523
1613
|
|
1524
1614
|
specify { expect(iban).to receive(:valid_country_code?).at_least(1) }
|
@@ -1529,381 +1619,666 @@ describe Ibandit::IBAN do
|
|
1529
1619
|
specify { expect(iban).to receive(:valid_format?).at_least(1) }
|
1530
1620
|
specify { expect(iban).to receive(:valid_bank_code_format?).at_least(1) }
|
1531
1621
|
|
1532
|
-
it
|
1622
|
+
it "validates the branch code length" do
|
1533
1623
|
expect(iban).to receive(:valid_branch_code_length?).at_least(1)
|
1534
1624
|
end
|
1535
1625
|
|
1536
|
-
it
|
1626
|
+
it "validates the account number length" do
|
1537
1627
|
expect(iban).to receive(:valid_account_number_length?).at_least(1)
|
1538
1628
|
end
|
1539
1629
|
|
1540
|
-
it
|
1630
|
+
it "validates the branch code format" do
|
1541
1631
|
expect(iban).to receive(:valid_branch_code_format?).at_least(1)
|
1542
1632
|
end
|
1543
1633
|
|
1544
|
-
it
|
1634
|
+
it "validates the account number format" do
|
1545
1635
|
expect(iban).to receive(:valid_account_number_format?).at_least(1)
|
1546
1636
|
end
|
1547
1637
|
|
1548
|
-
it
|
1638
|
+
it "runs local modulus checks" do
|
1549
1639
|
expect(iban).to receive(:valid_local_modulus_check?).at_least(1)
|
1550
1640
|
end
|
1551
1641
|
|
1552
|
-
it
|
1642
|
+
it "runs country specific checks" do
|
1553
1643
|
expect(iban).to receive(:passes_country_specific_checks?).at_least(1)
|
1554
1644
|
end
|
1555
1645
|
end
|
1556
1646
|
|
1557
|
-
context
|
1558
|
-
let(:iban_code) {
|
1647
|
+
context "for a valid Albanian IBAN" do
|
1648
|
+
let(:iban_code) { "AL47 2121 1009 0000 0002 3569 8741" }
|
1559
1649
|
it { is_expected.to be_valid }
|
1560
1650
|
end
|
1561
1651
|
|
1562
|
-
context
|
1563
|
-
let(:iban_code) {
|
1652
|
+
context "for a valid Andorran IBAN" do
|
1653
|
+
let(:iban_code) { "AD12 0001 2030 2003 5910 0100" }
|
1564
1654
|
it { is_expected.to be_valid }
|
1565
1655
|
end
|
1566
1656
|
|
1567
|
-
context
|
1568
|
-
let(:iban_code) {
|
1657
|
+
context "for a valid Austrian IBAN" do
|
1658
|
+
let(:iban_code) { "AT61 1904 3002 3457 3201" }
|
1569
1659
|
it { is_expected.to be_valid }
|
1570
1660
|
end
|
1571
1661
|
|
1572
|
-
context
|
1573
|
-
let(:iban_code) {
|
1662
|
+
context "for a valid Australian pseudo-IBAN" do
|
1663
|
+
let(:iban_code) { "AUZZ123456123456789" }
|
1664
|
+
it { is_expected.to be_valid }
|
1665
|
+
end
|
1666
|
+
|
1667
|
+
context "for an invalid Australian pseudo-IBAN" do
|
1668
|
+
let(:iban_code) { "AU99123456123456789" }
|
1669
|
+
it { is_expected.to_not be_valid }
|
1670
|
+
end
|
1671
|
+
|
1672
|
+
context "for a valid Azerbaijanian IBAN" do
|
1673
|
+
let(:iban_code) { "AZ21 NABZ 0000 0000 1370 1000 1944" }
|
1574
1674
|
it { is_expected.to be_valid }
|
1575
1675
|
end
|
1576
1676
|
|
1577
|
-
context
|
1578
|
-
let(:iban_code) {
|
1677
|
+
context "for an invalid Azerbaijanian IBAN" do
|
1678
|
+
let(:iban_code) { "AZ91 NABZ 0000 0000 1370 1000 1944" }
|
1679
|
+
it { is_expected.to_not be_valid }
|
1680
|
+
end
|
1681
|
+
|
1682
|
+
context "for a valid Bahrainian IBAN" do
|
1683
|
+
let(:iban_code) { "BH67 BMAG 0000 1299 1234 56" }
|
1579
1684
|
it { is_expected.to be_valid }
|
1580
1685
|
end
|
1581
1686
|
|
1582
|
-
context
|
1583
|
-
let(:iban_code) {
|
1687
|
+
context "for an invalid Bahrainian IBAN" do
|
1688
|
+
let(:iban_code) { "BH97 BMAG 0000 1299 1234 56" }
|
1689
|
+
it { is_expected.to_not be_valid }
|
1690
|
+
end
|
1691
|
+
|
1692
|
+
context "for a valid Belgian IBAN" do
|
1693
|
+
let(:iban_code) { "BE62 5100 0754 7061" }
|
1584
1694
|
it { is_expected.to be_valid }
|
1585
1695
|
end
|
1586
1696
|
|
1587
|
-
context
|
1588
|
-
let(:iban_code) {
|
1697
|
+
context "for an invalid Belgian IBAN" do
|
1698
|
+
let(:iban_code) { "BE92 5100 0754 7061" }
|
1699
|
+
it { is_expected.to_not be_valid }
|
1700
|
+
end
|
1701
|
+
|
1702
|
+
context "for a valid Bosnian IBAN" do
|
1703
|
+
let(:iban_code) { "BA39 1290 0794 0102 8494" }
|
1589
1704
|
it { is_expected.to be_valid }
|
1590
1705
|
end
|
1591
1706
|
|
1592
|
-
context
|
1593
|
-
let(:iban_code) {
|
1707
|
+
context "for an invalid Bosnian IBAN" do
|
1708
|
+
let(:iban_code) { "BA99 1290 0794 0102 8494" }
|
1709
|
+
it { is_expected.to_not be_valid }
|
1710
|
+
end
|
1711
|
+
|
1712
|
+
context "for a valid Bulgarian IBAN" do
|
1713
|
+
let(:iban_code) { "BG80 BNBG 9661 1020 3456 78" }
|
1594
1714
|
it { is_expected.to be_valid }
|
1595
1715
|
end
|
1596
1716
|
|
1597
|
-
context
|
1598
|
-
let(:iban_code) {
|
1717
|
+
context "for an invalid Bulgarian IBAN" do
|
1718
|
+
let(:iban_code) { "BG90 BNBG 9661 1020 3456 78" }
|
1719
|
+
it { is_expected.to_not be_valid }
|
1720
|
+
end
|
1721
|
+
|
1722
|
+
context "for a valid Croatian IBAN" do
|
1723
|
+
let(:iban_code) { "HR12 1001 0051 8630 0016 0" }
|
1599
1724
|
it { is_expected.to be_valid }
|
1600
1725
|
end
|
1601
1726
|
|
1602
|
-
context
|
1603
|
-
let(:iban_code) {
|
1727
|
+
context "for an invalid Croatian IBAN" do
|
1728
|
+
let(:iban_code) { "HR92 1001 0051 8630 0016 0" }
|
1729
|
+
it { is_expected.to_not be_valid }
|
1730
|
+
end
|
1731
|
+
|
1732
|
+
context "for a valid Cypriot IBAN" do
|
1733
|
+
let(:iban_code) { "CY17 0020 0128 0000 0012 0052 7600" }
|
1604
1734
|
it { is_expected.to be_valid }
|
1605
1735
|
end
|
1606
1736
|
|
1607
|
-
context
|
1608
|
-
let(:iban_code) {
|
1737
|
+
context "for an invalid Cypriot IBAN" do
|
1738
|
+
let(:iban_code) { "CY97 0020 0128 0000 0012 0052 7600" }
|
1739
|
+
it { is_expected.to_not be_valid }
|
1740
|
+
end
|
1741
|
+
|
1742
|
+
context "for a valid Czech IBAN" do
|
1743
|
+
let(:iban_code) { "CZ65 0800 0000 1920 0014 5399" }
|
1609
1744
|
it { is_expected.to be_valid }
|
1610
1745
|
end
|
1611
1746
|
|
1612
|
-
context
|
1613
|
-
let(:iban_code) {
|
1747
|
+
context "for an invalid Czech IBAN" do
|
1748
|
+
let(:iban_code) { "CZ95 0800 0000 1920 0014 5399" }
|
1749
|
+
it { is_expected.to_not be_valid }
|
1750
|
+
end
|
1751
|
+
|
1752
|
+
context "for a valid Danish IBAN" do
|
1753
|
+
let(:iban_code) { "DK50 0040 0440 1162 43" }
|
1614
1754
|
it { is_expected.to be_valid }
|
1615
1755
|
end
|
1616
1756
|
|
1617
|
-
context
|
1618
|
-
let(:iban_code) {
|
1757
|
+
context "for an invalid Danish IBAN" do
|
1758
|
+
let(:iban_code) { "DK90 0040 0440 1162 43" }
|
1759
|
+
it { is_expected.to_not be_valid }
|
1760
|
+
end
|
1761
|
+
|
1762
|
+
context "for a valid Estonian IBAN" do
|
1763
|
+
let(:iban_code) { "EE38 2200 2210 2014 5685" }
|
1619
1764
|
it { is_expected.to be_valid }
|
1620
1765
|
end
|
1621
1766
|
|
1622
|
-
context
|
1623
|
-
let(:iban_code) {
|
1767
|
+
context "for an invalid Estonian IBAN" do
|
1768
|
+
let(:iban_code) { "EE98 2200 2210 2014 5685" }
|
1769
|
+
it { is_expected.to_not be_valid }
|
1770
|
+
end
|
1771
|
+
|
1772
|
+
context "for a valid Faroe Islands IBAN" do
|
1773
|
+
let(:iban_code) { "FO97 5432 0388 8999 44" }
|
1624
1774
|
it { is_expected.to be_valid }
|
1625
1775
|
end
|
1626
1776
|
|
1627
|
-
context
|
1628
|
-
let(:iban_code) {
|
1777
|
+
context "for an invalid Faroe Islands IBAN" do
|
1778
|
+
let(:iban_code) { "FO27 5432 0388 8999 44" }
|
1779
|
+
it { is_expected.to_not be_valid }
|
1780
|
+
end
|
1781
|
+
|
1782
|
+
context "for a valid Finnish IBAN" do
|
1783
|
+
let(:iban_code) { "FI21 1234 5600 0007 85" }
|
1629
1784
|
it { is_expected.to be_valid }
|
1630
1785
|
end
|
1631
1786
|
|
1632
|
-
context
|
1633
|
-
let(:iban_code) {
|
1787
|
+
context "for an invalid Finnish IBAN" do
|
1788
|
+
let(:iban_code) { "FI91 1234 5600 0007 85" }
|
1789
|
+
it { is_expected.to_not be_valid }
|
1790
|
+
end
|
1791
|
+
|
1792
|
+
context "for a valid French IBAN" do
|
1793
|
+
let(:iban_code) { "FR14 2004 1010 0505 0001 3M02 606" }
|
1634
1794
|
it { is_expected.to be_valid }
|
1635
1795
|
end
|
1636
1796
|
|
1637
|
-
context
|
1638
|
-
let(:iban_code) {
|
1797
|
+
context "for an invalid French IBAN" do
|
1798
|
+
let(:iban_code) { "FR94 2004 1010 0505 0001 3M02 606" }
|
1799
|
+
it { is_expected.to_not be_valid }
|
1800
|
+
end
|
1801
|
+
|
1802
|
+
context "for a valid Georgian IBAN" do
|
1803
|
+
let(:iban_code) { "GE29 NB00 0000 0101 9049 17" }
|
1639
1804
|
it { is_expected.to be_valid }
|
1640
1805
|
end
|
1641
1806
|
|
1642
|
-
context
|
1643
|
-
let(:iban_code) {
|
1807
|
+
context "for an invalid Georgian IBAN" do
|
1808
|
+
let(:iban_code) { "GE99 NB00 0000 0101 9049 17" }
|
1809
|
+
it { is_expected.to_not be_valid }
|
1810
|
+
end
|
1811
|
+
|
1812
|
+
context "for a valid German IBAN" do
|
1813
|
+
let(:iban_code) { "DE89 3704 0044 0532 0130 00" }
|
1644
1814
|
it { is_expected.to be_valid }
|
1645
1815
|
end
|
1646
1816
|
|
1647
|
-
context
|
1648
|
-
let(:iban_code) {
|
1817
|
+
context "for an invalid German IBAN" do
|
1818
|
+
let(:iban_code) { "DE99 3704 0044 0532 0130 00" }
|
1819
|
+
it { is_expected.to_not be_valid }
|
1820
|
+
end
|
1821
|
+
|
1822
|
+
context "for a valid Gibraltan IBAN" do
|
1823
|
+
let(:iban_code) { "GI75 NWBK 0000 0000 7099 453" }
|
1649
1824
|
it { is_expected.to be_valid }
|
1650
1825
|
end
|
1651
1826
|
|
1652
|
-
context
|
1653
|
-
let(:iban_code) {
|
1827
|
+
context "for an invalid Gibraltan IBAN" do
|
1828
|
+
let(:iban_code) { "GI95 NWBK 0000 0000 7099 453" }
|
1829
|
+
it { is_expected.to_not be_valid }
|
1830
|
+
end
|
1831
|
+
|
1832
|
+
context "for a valid Greek IBAN" do
|
1833
|
+
let(:iban_code) { "GR16 0110 1250 0000 0001 2300 695" }
|
1654
1834
|
it { is_expected.to be_valid }
|
1655
1835
|
end
|
1656
1836
|
|
1657
|
-
context
|
1658
|
-
let(:iban_code) {
|
1837
|
+
context "for an invalid Greek IBAN" do
|
1838
|
+
let(:iban_code) { "GR96 0110 1250 0000 0001 2300 695" }
|
1839
|
+
it { is_expected.to_not be_valid }
|
1840
|
+
end
|
1841
|
+
|
1842
|
+
context "for a valid Greenland IBAN" do
|
1843
|
+
let(:iban_code) { "GL56 0444 9876 5432 10" }
|
1659
1844
|
it { is_expected.to be_valid }
|
1660
1845
|
end
|
1661
1846
|
|
1662
|
-
context
|
1663
|
-
let(:iban_code) {
|
1847
|
+
context "for an invalid Greenland IBAN" do
|
1848
|
+
let(:iban_code) { "GL96 0444 9876 5432 10" }
|
1849
|
+
it { is_expected.to_not be_valid }
|
1850
|
+
end
|
1851
|
+
|
1852
|
+
context "for a valid Hungarian IBAN" do
|
1853
|
+
let(:iban_code) { "HU42 1177 3016 1111 1018 0000 0000" }
|
1664
1854
|
it { is_expected.to be_valid }
|
1665
1855
|
end
|
1666
1856
|
|
1667
|
-
context
|
1668
|
-
let(:iban_code) {
|
1857
|
+
context "for an invalid Hungarian IBAN" do
|
1858
|
+
let(:iban_code) { "HU92 1177 3016 1111 1018 0000 0000" }
|
1859
|
+
it { is_expected.to_not be_valid }
|
1860
|
+
end
|
1861
|
+
|
1862
|
+
context "for a valid Icelandic IBAN" do
|
1863
|
+
let(:iban_code) { "IS14 0159 2600 7654 5510 7303 39" }
|
1669
1864
|
it { is_expected.to be_valid }
|
1670
1865
|
end
|
1671
1866
|
|
1672
|
-
context
|
1673
|
-
let(:iban_code) {
|
1867
|
+
context "for an invalid Icelandic IBAN" do
|
1868
|
+
let(:iban_code) { "IS94 0159 2600 7654 5510 7303 39" }
|
1869
|
+
it { is_expected.to_not be_valid }
|
1870
|
+
end
|
1871
|
+
|
1872
|
+
context "for a valid Irish IBAN" do
|
1873
|
+
let(:iban_code) { "IE29 AIBK 9311 5212 3456 78" }
|
1674
1874
|
it { is_expected.to be_valid }
|
1675
1875
|
end
|
1676
1876
|
|
1677
|
-
context
|
1678
|
-
let(:iban_code) {
|
1877
|
+
context "for an invalid Irish IBAN" do
|
1878
|
+
let(:iban_code) { "IE99 AIBK 9311 5212 3456 78" }
|
1879
|
+
it { is_expected.to_not be_valid }
|
1880
|
+
end
|
1881
|
+
|
1882
|
+
context "for a valid Israeli IBAN" do
|
1883
|
+
let(:iban_code) { "IL62 0108 0000 0009 9999 999" }
|
1679
1884
|
it { is_expected.to be_valid }
|
1680
1885
|
end
|
1681
1886
|
|
1682
|
-
context
|
1683
|
-
let(:iban_code) {
|
1887
|
+
context "for an invalid Israeli IBAN" do
|
1888
|
+
let(:iban_code) { "IL92 0108 0000 0009 9999 999" }
|
1889
|
+
it { is_expected.to_not be_valid }
|
1890
|
+
end
|
1891
|
+
|
1892
|
+
context "for a valid Italian IBAN" do
|
1893
|
+
let(:iban_code) { "IT40 S054 2811 1010 0000 0123 456" }
|
1684
1894
|
it { is_expected.to be_valid }
|
1685
1895
|
end
|
1686
1896
|
|
1687
|
-
context
|
1688
|
-
let(:iban_code) {
|
1897
|
+
context "for an invalid Italian IBAN" do
|
1898
|
+
let(:iban_code) { "IT90 S054 2811 1010 0000 0123 456" }
|
1899
|
+
it { is_expected.to_not be_valid }
|
1900
|
+
end
|
1901
|
+
|
1902
|
+
context "for a valid Jordanian IBAN" do
|
1903
|
+
let(:iban_code) { "JO94 CBJO 0010 0000 0000 0131 0003 02" }
|
1689
1904
|
it { is_expected.to be_valid }
|
1690
1905
|
end
|
1691
1906
|
|
1692
|
-
context
|
1693
|
-
let(:iban_code) {
|
1907
|
+
context "for an invalid Jordanian IBAN" do
|
1908
|
+
let(:iban_code) { "JO24 CBJO 0010 0000 0000 0131 0003 02" }
|
1909
|
+
it { is_expected.to_not be_valid }
|
1910
|
+
end
|
1911
|
+
|
1912
|
+
context "for a valid Kuwaiti IBAN" do
|
1913
|
+
let(:iban_code) { "KW81 CBKU 0000 0000 0000 1234 5601 01" }
|
1694
1914
|
it { is_expected.to be_valid }
|
1695
1915
|
end
|
1696
1916
|
|
1697
|
-
context
|
1698
|
-
let(:iban_code) {
|
1917
|
+
context "for an invalid Kuwaiti IBAN" do
|
1918
|
+
let(:iban_code) { "KW91 CBKU 0000 0000 0000 1234 5601 01" }
|
1919
|
+
it { is_expected.to_not be_valid }
|
1920
|
+
end
|
1921
|
+
|
1922
|
+
context "for a valid Latvian IBAN" do
|
1923
|
+
let(:iban_code) { "LV80 BANK 0000 4351 9500 1" }
|
1699
1924
|
it { is_expected.to be_valid }
|
1700
1925
|
end
|
1701
1926
|
|
1702
|
-
context
|
1703
|
-
let(:iban_code) {
|
1927
|
+
context "for an invalid Latvian IBAN" do
|
1928
|
+
let(:iban_code) { "LV90 BANK 0000 4351 9500 1" }
|
1929
|
+
it { is_expected.to_not be_valid }
|
1930
|
+
end
|
1931
|
+
|
1932
|
+
context "for a valid Lebanese IBAN" do
|
1933
|
+
let(:iban_code) { "LB62 0999 0000 0001 0019 0122 9114" }
|
1704
1934
|
it { is_expected.to be_valid }
|
1705
1935
|
end
|
1706
1936
|
|
1707
|
-
context
|
1708
|
-
let(:iban_code) {
|
1937
|
+
context "for an invalid Lebanese IBAN" do
|
1938
|
+
let(:iban_code) { "LB92 0999 0000 0001 0019 0122 9114" }
|
1939
|
+
it { is_expected.to_not be_valid }
|
1940
|
+
end
|
1941
|
+
|
1942
|
+
context "for a valid Liechtensteinian IBAN" do
|
1943
|
+
let(:iban_code) { "LI21 0881 0000 2324 013A A" }
|
1709
1944
|
it { is_expected.to be_valid }
|
1710
1945
|
end
|
1711
1946
|
|
1712
|
-
context
|
1713
|
-
let(:iban_code) {
|
1947
|
+
context "for an invalid Liechtensteinian IBAN" do
|
1948
|
+
let(:iban_code) { "LI91 0881 0000 2324 013A A" }
|
1949
|
+
it { is_expected.to_not be_valid }
|
1950
|
+
end
|
1951
|
+
|
1952
|
+
context "for a valid Lithuanian IBAN" do
|
1953
|
+
let(:iban_code) { "LT12 1000 0111 0100 1000" }
|
1714
1954
|
it { is_expected.to be_valid }
|
1715
1955
|
end
|
1716
1956
|
|
1717
|
-
context
|
1718
|
-
let(:iban_code) {
|
1957
|
+
context "for an invalid Lithuanian IBAN" do
|
1958
|
+
let(:iban_code) { "LT92 1000 0111 0100 1000" }
|
1959
|
+
it { is_expected.to_not be_valid }
|
1960
|
+
end
|
1961
|
+
|
1962
|
+
context "for a valid Luxembourgian IBAN" do
|
1963
|
+
let(:iban_code) { "LU28 0019 4006 4475 0000" }
|
1719
1964
|
it { is_expected.to be_valid }
|
1720
1965
|
end
|
1721
1966
|
|
1722
|
-
context
|
1723
|
-
let(:iban_code) {
|
1967
|
+
context "for an invalid Luxembourgian IBAN" do
|
1968
|
+
let(:iban_code) { "LU98 0019 4006 4475 0000" }
|
1969
|
+
it { is_expected.to_not be_valid }
|
1970
|
+
end
|
1971
|
+
|
1972
|
+
context "for a valid Macedonian IBAN" do
|
1973
|
+
let(:iban_code) { "MK072 5012 0000 0589 84" }
|
1724
1974
|
it { is_expected.to be_valid }
|
1725
1975
|
end
|
1726
1976
|
|
1727
|
-
context
|
1728
|
-
let(:iban_code) {
|
1977
|
+
context "for an invalid Macedonian IBAN" do
|
1978
|
+
let(:iban_code) { "MK972 5012 0000 0589 84" }
|
1979
|
+
it { is_expected.to_not be_valid }
|
1980
|
+
end
|
1981
|
+
|
1982
|
+
context "for a valid Maltese IBAN" do
|
1983
|
+
let(:iban_code) { "MT84 MALT 0110 0001 2345 MTLC AST0 01S" }
|
1729
1984
|
it { is_expected.to be_valid }
|
1730
1985
|
end
|
1731
1986
|
|
1732
|
-
context
|
1733
|
-
let(:iban_code) {
|
1987
|
+
context "for an invalid Maltese IBAN" do
|
1988
|
+
let(:iban_code) { "MT94 MALT 0110 0001 2345 MTLC AST0 01S" }
|
1989
|
+
it { is_expected.to_not be_valid }
|
1990
|
+
end
|
1991
|
+
|
1992
|
+
context "for a valid Maurititanian IBAN" do
|
1993
|
+
let(:iban_code) { "MU17 BOMM 0101 1010 3030 0200 000M UR" }
|
1734
1994
|
it { is_expected.to be_valid }
|
1735
1995
|
end
|
1736
1996
|
|
1737
|
-
context
|
1738
|
-
let(:iban_code) {
|
1997
|
+
context "for an invalid Maurititanian IBAN" do
|
1998
|
+
let(:iban_code) { "MU97 BOMM 0101 1010 3030 0200 000M UR" }
|
1999
|
+
it { is_expected.to_not be_valid }
|
2000
|
+
end
|
2001
|
+
|
2002
|
+
context "for a valid Moldovan IBAN" do
|
2003
|
+
let(:iban_code) { "MD24 AG00 0225 1000 1310 4168" }
|
1739
2004
|
it { is_expected.to be_valid }
|
1740
2005
|
end
|
1741
2006
|
|
1742
|
-
context
|
1743
|
-
let(:iban_code) {
|
2007
|
+
context "for an invalid Moldovan IBAN" do
|
2008
|
+
let(:iban_code) { "MD94 AG00 0225 1000 1310 4168" }
|
2009
|
+
it { is_expected.to_not be_valid }
|
2010
|
+
end
|
2011
|
+
|
2012
|
+
context "for a valid Monocan IBAN" do
|
2013
|
+
let(:iban_code) { "MC93 2005 2222 1001 1223 3M44 555" }
|
1744
2014
|
it { is_expected.to be_valid }
|
1745
2015
|
end
|
1746
2016
|
|
1747
|
-
context
|
1748
|
-
let(:iban_code) {
|
2017
|
+
context "for an invalid Monocan IBAN" do
|
2018
|
+
let(:iban_code) { "MC23 2005 2222 1001 1223 3M44 555" }
|
2019
|
+
it { is_expected.to_not be_valid }
|
2020
|
+
end
|
2021
|
+
|
2022
|
+
context "for a valid Montenegrian IBAN" do
|
2023
|
+
let(:iban_code) { "ME25 5050 0001 2345 6789 51" }
|
1749
2024
|
it { is_expected.to be_valid }
|
1750
2025
|
end
|
1751
2026
|
|
1752
|
-
context
|
1753
|
-
let(:iban_code) {
|
2027
|
+
context "for an invalid Montenegrian IBAN" do
|
2028
|
+
let(:iban_code) { "ME95 5050 0001 2345 6789 51" }
|
2029
|
+
it { is_expected.to_not be_valid }
|
2030
|
+
end
|
2031
|
+
|
2032
|
+
context "for a valid Dutch IBAN" do
|
2033
|
+
let(:iban_code) { "NL39 RABO 0300 0652 64" }
|
1754
2034
|
it { is_expected.to be_valid }
|
1755
2035
|
end
|
1756
2036
|
|
1757
|
-
context
|
1758
|
-
let(:iban_code) {
|
2037
|
+
context "for an invalid Dutch IBAN" do
|
2038
|
+
let(:iban_code) { "NL99 RABO 0300 0652 64" }
|
2039
|
+
it { is_expected.to_not be_valid }
|
2040
|
+
end
|
2041
|
+
|
2042
|
+
context "for a valid Norwegian IBAN" do
|
2043
|
+
let(:iban_code) { "NO93 8601 1117 947" }
|
1759
2044
|
it { is_expected.to be_valid }
|
1760
2045
|
end
|
1761
2046
|
|
1762
|
-
context
|
1763
|
-
let(:iban_code) {
|
2047
|
+
context "for an invalid Norwegian IBAN" do
|
2048
|
+
let(:iban_code) { "NO23 8601 1117 947" }
|
2049
|
+
it { is_expected.to_not be_valid }
|
2050
|
+
end
|
2051
|
+
|
2052
|
+
context "for a valid Pakistani IBAN" do
|
2053
|
+
let(:iban_code) { "PK36 SCBL 0000 0011 2345 6702" }
|
1764
2054
|
it { is_expected.to be_valid }
|
1765
2055
|
end
|
1766
2056
|
|
1767
|
-
context
|
1768
|
-
let(:iban_code) {
|
2057
|
+
context "for an invalid Pakistani IBAN" do
|
2058
|
+
let(:iban_code) { "PK96 SCBL 0000 0011 2345 6702" }
|
2059
|
+
it { is_expected.to_not be_valid }
|
2060
|
+
end
|
2061
|
+
|
2062
|
+
context "for a valid Polish IBAN" do
|
2063
|
+
let(:iban_code) { "PL60 1020 1026 0000 0422 7020 1111" }
|
1769
2064
|
it { is_expected.to be_valid }
|
1770
2065
|
end
|
1771
2066
|
|
1772
|
-
context
|
1773
|
-
let(:iban_code) {
|
2067
|
+
context "for an invalid Polish IBAN" do
|
2068
|
+
let(:iban_code) { "PL90 1020 1026 0000 0422 7020 1111" }
|
2069
|
+
it { is_expected.to_not be_valid }
|
2070
|
+
end
|
2071
|
+
|
2072
|
+
context "for a valid Potuguese IBAN" do
|
2073
|
+
let(:iban_code) { "PT50 0002 0123 1234 5678 9015 4" }
|
1774
2074
|
it { is_expected.to be_valid }
|
1775
2075
|
end
|
1776
2076
|
|
1777
|
-
context
|
1778
|
-
let(:iban_code) {
|
2077
|
+
context "for an invalid Potuguese IBAN" do
|
2078
|
+
let(:iban_code) { "PT90 0002 0123 1234 5678 9015 4" }
|
2079
|
+
it { is_expected.to_not be_valid }
|
2080
|
+
end
|
2081
|
+
|
2082
|
+
context "for a valid Qatari IBAN" do
|
2083
|
+
let(:iban_code) { "QA58 DOHB 0000 1234 5678 90AB CDEF G" }
|
1779
2084
|
it { is_expected.to be_valid }
|
1780
2085
|
end
|
1781
2086
|
|
1782
|
-
context
|
1783
|
-
let(:iban_code) {
|
2087
|
+
context "for an invalid Qatari IBAN" do
|
2088
|
+
let(:iban_code) { "QA98 DOHB 0000 1234 5678 90AB CDEF G" }
|
2089
|
+
it { is_expected.to_not be_valid }
|
2090
|
+
end
|
2091
|
+
|
2092
|
+
context "for a valid Romanian IBAN" do
|
2093
|
+
let(:iban_code) { "RO49 AAAA 1B31 0075 9384 0000" }
|
1784
2094
|
it { is_expected.to be_valid }
|
1785
2095
|
end
|
1786
2096
|
|
1787
|
-
context
|
1788
|
-
let(:iban_code) {
|
2097
|
+
context "for an invalid Romanian IBAN" do
|
2098
|
+
let(:iban_code) { "RO99 AAAA 1B31 0075 9384 0000" }
|
2099
|
+
it { is_expected.to_not be_valid }
|
2100
|
+
end
|
2101
|
+
|
2102
|
+
context "for a valid San Marinian IBAN" do
|
2103
|
+
let(:iban_code) { "SM86 U032 2509 8000 0000 0270 100" }
|
1789
2104
|
it { is_expected.to be_valid }
|
1790
2105
|
end
|
1791
2106
|
|
1792
|
-
context
|
1793
|
-
let(:iban_code) {
|
2107
|
+
context "for an invalid San Marinian IBAN" do
|
2108
|
+
let(:iban_code) { "SM96 U032 2509 8000 0000 0270 100" }
|
2109
|
+
it { is_expected.to_not be_valid }
|
2110
|
+
end
|
2111
|
+
|
2112
|
+
context "for a valid Saudi IBAN" do
|
2113
|
+
let(:iban_code) { "SA03 8000 0000 6080 1016 7519" }
|
1794
2114
|
it { is_expected.to be_valid }
|
1795
2115
|
end
|
1796
2116
|
|
1797
|
-
context
|
1798
|
-
let(:iban_code) {
|
2117
|
+
context "for an invalid Saudi IBAN" do
|
2118
|
+
let(:iban_code) { "SA93 8000 0000 6080 1016 7519" }
|
2119
|
+
it { is_expected.to_not be_valid }
|
2120
|
+
end
|
2121
|
+
|
2122
|
+
context "for a valid Serbian IBAN" do
|
2123
|
+
let(:iban_code) { "RS35 2600 0560 1001 6113 79" }
|
1799
2124
|
it { is_expected.to be_valid }
|
1800
2125
|
end
|
1801
2126
|
|
1802
|
-
context
|
1803
|
-
let(:iban_code) {
|
2127
|
+
context "for an invalid Serbian IBAN" do
|
2128
|
+
let(:iban_code) { "RS95 2600 0560 1001 6113 79" }
|
2129
|
+
it { is_expected.to_not be_valid }
|
2130
|
+
end
|
2131
|
+
|
2132
|
+
context "for a valid Slovakian IBAN" do
|
2133
|
+
let(:iban_code) { "SK31 1200 0000 1987 4263 7541" }
|
1804
2134
|
it { is_expected.to be_valid }
|
1805
2135
|
end
|
1806
2136
|
|
1807
|
-
context
|
1808
|
-
let(:iban_code) {
|
2137
|
+
context "for an invalid Slovakian IBAN" do
|
2138
|
+
let(:iban_code) { "SK91 1200 0000 1987 4263 7541" }
|
2139
|
+
it { is_expected.to_not be_valid }
|
2140
|
+
end
|
2141
|
+
|
2142
|
+
context "for a valid Slovenian IBAN" do
|
2143
|
+
let(:iban_code) { "SI56 1910 0000 0123 438" }
|
1809
2144
|
it { is_expected.to be_valid }
|
1810
2145
|
end
|
1811
2146
|
|
1812
|
-
context
|
1813
|
-
let(:iban_code) {
|
2147
|
+
context "for an invalid Slovenian IBAN" do
|
2148
|
+
let(:iban_code) { "SI96 1910 0000 0123 438" }
|
2149
|
+
it { is_expected.to_not be_valid }
|
2150
|
+
end
|
2151
|
+
|
2152
|
+
context "for a valid Spanish IBAN" do
|
2153
|
+
let(:iban_code) { "ES80 2310 0001 1800 0001 2345" }
|
1814
2154
|
it { is_expected.to be_valid }
|
1815
2155
|
end
|
1816
2156
|
|
1817
|
-
context
|
1818
|
-
let(:iban_code) {
|
2157
|
+
context "for an invalid Spanish IBAN" do
|
2158
|
+
let(:iban_code) { "ES90 2310 0001 1800 0001 2345" }
|
2159
|
+
it { is_expected.to_not be_valid }
|
2160
|
+
end
|
2161
|
+
|
2162
|
+
context "for a valid Swedish IBAN" do
|
2163
|
+
let(:iban_code) { "SE35 5000 0000 0549 1000 0003" }
|
1819
2164
|
it { is_expected.to be_valid }
|
1820
2165
|
end
|
1821
2166
|
|
1822
|
-
context
|
1823
|
-
let(:iban_code) {
|
2167
|
+
context "for an invalid Swedish IBAN" do
|
2168
|
+
let(:iban_code) { "SE95 5000 0000 0549 1000 0003" }
|
2169
|
+
it { is_expected.to_not be_valid }
|
2170
|
+
end
|
2171
|
+
|
2172
|
+
context "for a valid Swiss IBAN" do
|
2173
|
+
let(:iban_code) { "CH93 0076 2011 6238 5295 7" }
|
1824
2174
|
it { is_expected.to be_valid }
|
1825
2175
|
end
|
1826
2176
|
|
1827
|
-
context
|
1828
|
-
let(:iban_code) {
|
2177
|
+
context "for an invalid Swiss IBAN" do
|
2178
|
+
let(:iban_code) { "CH23 0076 2011 6238 5295 7" }
|
2179
|
+
it { is_expected.to_not be_valid }
|
2180
|
+
end
|
2181
|
+
|
2182
|
+
context "for a valid Tunisian IBAN" do
|
2183
|
+
let(:iban_code) { "TN59 1000 6035 1835 9847 8831" }
|
1829
2184
|
it { is_expected.to be_valid }
|
1830
2185
|
end
|
1831
2186
|
|
1832
|
-
context
|
1833
|
-
let(:iban_code) {
|
2187
|
+
context "for an invalid Tunisian IBAN" do
|
2188
|
+
let(:iban_code) { "TN99 1000 6035 1835 9847 8831" }
|
2189
|
+
it { is_expected.to_not be_valid }
|
2190
|
+
end
|
2191
|
+
|
2192
|
+
context "for a valid Turkish IBAN" do
|
2193
|
+
let(:iban_code) { "TR33 0006 1005 1978 6457 8413 26" }
|
1834
2194
|
it { is_expected.to be_valid }
|
1835
2195
|
end
|
1836
2196
|
|
1837
|
-
context
|
1838
|
-
let(:iban_code) {
|
2197
|
+
context "for an invalid Turkish IBAN" do
|
2198
|
+
let(:iban_code) { "TR93 0006 1005 1978 6457 8413 26" }
|
2199
|
+
it { is_expected.to_not be_valid }
|
2200
|
+
end
|
2201
|
+
|
2202
|
+
context "for a valid UAE IBAN" do
|
2203
|
+
let(:iban_code) { "AE07 0331 2345 6789 0123 456" }
|
1839
2204
|
it { is_expected.to be_valid }
|
1840
2205
|
end
|
1841
2206
|
|
1842
|
-
context
|
1843
|
-
let(:iban_code) {
|
2207
|
+
context "for an invalid UAE IBAN" do
|
2208
|
+
let(:iban_code) { "AE97 0331 2345 6789 0123 456" }
|
2209
|
+
it { is_expected.to_not be_valid }
|
2210
|
+
end
|
2211
|
+
|
2212
|
+
context "for a valid UK IBAN" do
|
2213
|
+
let(:iban_code) { "GB82 WEST 1234 5698 7654 32" }
|
1844
2214
|
it { is_expected.to be_valid }
|
1845
2215
|
end
|
2216
|
+
|
2217
|
+
context "for an invalid UK IBAN" do
|
2218
|
+
let(:iban_code) { "GB92 WEST 1234 5698 7654 32" }
|
2219
|
+
it { is_expected.to_not be_valid }
|
2220
|
+
end
|
1846
2221
|
end
|
1847
2222
|
|
1848
|
-
describe
|
1849
|
-
context
|
1850
|
-
let(:iban_code) {
|
1851
|
-
its(:local_check_digits) { is_expected.to eq(
|
2223
|
+
describe "#local_check_digits" do
|
2224
|
+
context "with a Belgian IBAN" do
|
2225
|
+
let(:iban_code) { "BE62510007547061" }
|
2226
|
+
its(:local_check_digits) { is_expected.to eq("61") }
|
1852
2227
|
end
|
1853
2228
|
|
1854
|
-
context
|
1855
|
-
let(:iban_code) {
|
1856
|
-
its(:local_check_digits) { is_expected.to eq(
|
2229
|
+
context "with a French IBAN" do
|
2230
|
+
let(:iban_code) { "FR1234567890123456789012345" }
|
2231
|
+
its(:local_check_digits) { is_expected.to eq("45") }
|
1857
2232
|
end
|
1858
2233
|
|
1859
|
-
context
|
1860
|
-
let(:iban_code) {
|
1861
|
-
its(:local_check_digits) { is_expected.to eq(
|
2234
|
+
context "with a Monocan IBAN" do
|
2235
|
+
let(:iban_code) { "MC9320052222100112233M44555" }
|
2236
|
+
its(:local_check_digits) { is_expected.to eq("55") }
|
1862
2237
|
end
|
1863
2238
|
|
1864
|
-
context
|
1865
|
-
let(:iban_code) {
|
1866
|
-
its(:local_check_digits) { is_expected.to eq(
|
2239
|
+
context "with a Spanish IBAN" do
|
2240
|
+
let(:iban_code) { "ES1212345678911234567890" }
|
2241
|
+
its(:local_check_digits) { is_expected.to eq("91") }
|
1867
2242
|
end
|
1868
2243
|
|
1869
|
-
context
|
1870
|
-
let(:iban_code) {
|
1871
|
-
its(:local_check_digits) { is_expected.to eq(
|
2244
|
+
context "with an Italian IBAN" do
|
2245
|
+
let(:iban_code) { "IT12A1234567890123456789012" }
|
2246
|
+
its(:local_check_digits) { is_expected.to eq("A") }
|
1872
2247
|
end
|
1873
2248
|
|
1874
|
-
context
|
1875
|
-
let(:iban_code) {
|
1876
|
-
its(:local_check_digits) { is_expected.to eq(
|
2249
|
+
context "with an Estonian IBAN" do
|
2250
|
+
let(:iban_code) { "EE382200221020145685" }
|
2251
|
+
its(:local_check_digits) { is_expected.to eq("5") }
|
1877
2252
|
end
|
1878
2253
|
|
1879
|
-
context
|
1880
|
-
let(:iban_code) {
|
1881
|
-
its(:local_check_digits) { is_expected.to eq(
|
2254
|
+
context "with an Finnish IBAN" do
|
2255
|
+
let(:iban_code) { "FI2112345600000785" }
|
2256
|
+
its(:local_check_digits) { is_expected.to eq("5") }
|
1882
2257
|
end
|
1883
2258
|
|
1884
|
-
context
|
1885
|
-
let(:iban_code) {
|
1886
|
-
its(:local_check_digits) { is_expected.to eq(
|
2259
|
+
context "with an Portuguese IBAN" do
|
2260
|
+
let(:iban_code) { "PT50000201231234567890154" }
|
2261
|
+
its(:local_check_digits) { is_expected.to eq("54") }
|
1887
2262
|
end
|
1888
2263
|
|
1889
|
-
context
|
1890
|
-
let(:iban_code) {
|
1891
|
-
its(:local_check_digits) { is_expected.to eq(
|
2264
|
+
context "with a Norwegian IBAN" do
|
2265
|
+
let(:iban_code) { "NO9386011117947" }
|
2266
|
+
its(:local_check_digits) { is_expected.to eq("7") }
|
1892
2267
|
end
|
1893
2268
|
|
1894
|
-
context
|
1895
|
-
let(:iban_code) {
|
1896
|
-
its(:local_check_digits) { is_expected.to eq(
|
2269
|
+
context "with an Icelandic IBAN" do
|
2270
|
+
let(:iban_code) { "IS250311260024684606972049" }
|
2271
|
+
its(:local_check_digits) { is_expected.to eq("4") }
|
1897
2272
|
end
|
1898
2273
|
|
1899
|
-
context
|
1900
|
-
let(:iban_code) {
|
1901
|
-
its(:local_check_digits) { is_expected.to eq(
|
2274
|
+
context "with a Slovakian IBAN" do
|
2275
|
+
let(:iban_code) { "SK3112000000198742637541" }
|
2276
|
+
its(:local_check_digits) { is_expected.to eq("9") }
|
1902
2277
|
end
|
1903
2278
|
|
1904
|
-
context
|
1905
|
-
let(:iban_code) {
|
1906
|
-
its(:local_check_digits) { is_expected.to eq(
|
2279
|
+
context "with a Dutch IBAN" do
|
2280
|
+
let(:iban_code) { "NL91ABNA0417164300" }
|
2281
|
+
its(:local_check_digits) { is_expected.to eq("0") }
|
1907
2282
|
end
|
1908
2283
|
end
|
1909
2284
|
end
|