ibandit 0.11.19 → 0.11.20
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 +1 -4
- data/.rubocop_todo.yml +60 -13
- data/.travis.yml +1 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +0 -6
- data/README.md +18 -0
- data/ibandit.gemspec +2 -2
- data/lib/ibandit.rb +3 -3
- data/lib/ibandit/german_details_converter.rb +3 -3
- data/lib/ibandit/local_details_cleaner.rb +3 -1
- data/lib/ibandit/sweden/bank_lookup.rb +1 -1
- data/lib/ibandit/version.rb +1 -1
- data/spec/ibandit/german_details_converter_spec.rb +9 -5
- data/spec/ibandit/iban_assembler_spec.rb +87 -0
- data/spec/ibandit/iban_spec.rb +186 -35
- data/spec/ibandit/iban_splitter_spec.rb +4 -0
- data/spec/ibandit/local_details_cleaner_spec.rb +140 -0
- data/spec/ibandit/structure_spec.rb +1 -1
- data/spec/ibandit/sweden/validator_spec.rb +33 -0
- metadata +37 -37
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e3f94e719c75ae4ffb2c6ddae2412ae27b3cca57
|
|
4
|
+
data.tar.gz: 2aa1489dab17b0fa534f3c720dc2a80b65b3f5f0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3c08763237ed36144a0ab42a8fcef5f13204e4c3ae86db1f43ea092da70a9a4262cac0a79d9ceb6c42911349d4c458e667034ddf5da7609cf3eda3ff3606f64f
|
|
7
|
+
data.tar.gz: 54f039ca73d46e43164b21185884e24445a7f31b11df376add970978de7367d2ace07a9d4394408c398f7776a95b8e6cf6d4a63e54a90d248fcbefbb145dfeeb
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
|
@@ -1,27 +1,74 @@
|
|
|
1
|
-
# This configuration was generated by
|
|
2
|
-
#
|
|
1
|
+
# This configuration was generated by
|
|
2
|
+
# `rubocop --auto-gen-config`
|
|
3
|
+
# on 2018-10-18 09:23:39 +0100 using RuboCop version 0.58.2.
|
|
3
4
|
# The point is for the user to remove these configuration records
|
|
4
5
|
# one by one as the offenses are removed from the code base.
|
|
5
6
|
# Note that changes in the inspected code, or installation of new
|
|
6
7
|
# versions of RuboCop, may require this file to be generated again.
|
|
7
8
|
|
|
8
|
-
# Offense count:
|
|
9
|
+
# Offense count: 10
|
|
9
10
|
Metrics/AbcSize:
|
|
10
|
-
Max:
|
|
11
|
+
Max: 26
|
|
12
|
+
|
|
13
|
+
# Offense count: 3
|
|
14
|
+
Metrics/CyclomaticComplexity:
|
|
15
|
+
Max: 8
|
|
11
16
|
|
|
12
17
|
# Offense count: 1
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
RSpec/DescribeClass:
|
|
19
|
+
Exclude:
|
|
20
|
+
- 'spec/ibandit/structure_spec.rb'
|
|
16
21
|
|
|
17
22
|
# Offense count: 1
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
# Configuration parameters: Max.
|
|
24
|
+
RSpec/ExampleLength:
|
|
25
|
+
Exclude:
|
|
26
|
+
- 'spec/ibandit/iban_spec.rb'
|
|
20
27
|
|
|
21
|
-
# Offense count:
|
|
22
|
-
|
|
23
|
-
|
|
28
|
+
# Offense count: 8
|
|
29
|
+
# Configuration parameters: AggregateFailuresByDefault.
|
|
30
|
+
RSpec/MultipleExpectations:
|
|
31
|
+
Max: 2
|
|
32
|
+
|
|
33
|
+
# Offense count: 13
|
|
34
|
+
RSpec/NamedSubject:
|
|
35
|
+
Exclude:
|
|
36
|
+
- 'spec/ibandit/german_details_converter_spec.rb'
|
|
37
|
+
- 'spec/ibandit/iban_spec.rb'
|
|
38
|
+
|
|
39
|
+
# Offense count: 344
|
|
40
|
+
RSpec/NestedGroups:
|
|
41
|
+
Max: 6
|
|
42
|
+
|
|
43
|
+
# Offense count: 3
|
|
44
|
+
RSpec/ScatteredLet:
|
|
45
|
+
Exclude:
|
|
46
|
+
- 'spec/ibandit/iban_spec.rb'
|
|
47
|
+
|
|
48
|
+
# Offense count: 18
|
|
49
|
+
RSpec/ScatteredSetup:
|
|
50
|
+
Exclude:
|
|
51
|
+
- 'spec/ibandit/iban_assembler_spec.rb'
|
|
52
|
+
- 'spec/ibandit/iban_spec.rb'
|
|
53
|
+
|
|
54
|
+
# Offense count: 13
|
|
55
|
+
RSpec/SubjectStub:
|
|
56
|
+
Exclude:
|
|
57
|
+
- 'spec/ibandit/iban_spec.rb'
|
|
24
58
|
|
|
25
59
|
# Offense count: 4
|
|
60
|
+
# Configuration parameters: IgnoreSymbolicNames.
|
|
61
|
+
RSpec/VerifiedDoubles:
|
|
62
|
+
Exclude:
|
|
63
|
+
- 'spec/ibandit/iban_spec.rb'
|
|
64
|
+
|
|
65
|
+
# Offense count: 5
|
|
66
|
+
# Cop supports --auto-correct.
|
|
67
|
+
# Configuration parameters: AutoCorrect, EnforcedStyle.
|
|
68
|
+
# SupportedStyles: predicate, comparison
|
|
26
69
|
Style/NumericPredicate:
|
|
27
|
-
|
|
70
|
+
Exclude:
|
|
71
|
+
- 'spec/**/*'
|
|
72
|
+
- 'lib/ibandit/iban.rb'
|
|
73
|
+
- 'lib/ibandit/pseudo_iban_assembler.rb'
|
|
74
|
+
- 'lib/ibandit/pseudo_iban_splitter.rb'
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -505,6 +505,7 @@ iban.branch_code # => "7507"
|
|
|
505
505
|
iban.account_number # => "1211203"
|
|
506
506
|
iban.iban # => "SE2680000000075071211203"
|
|
507
507
|
|
|
508
|
+
# Australia
|
|
508
509
|
iban = Ibandit::IBAN.new(
|
|
509
510
|
country_code: 'AU',
|
|
510
511
|
branch_code: '123-456', # 6 digit BSB number
|
|
@@ -519,6 +520,23 @@ iban.branch_code # => "123456"
|
|
|
519
520
|
iban.account_number # => "123456789"
|
|
520
521
|
iban.iban # => nil
|
|
521
522
|
|
|
523
|
+
# Canada
|
|
524
|
+
iban = Ibandit::IBAN.new(
|
|
525
|
+
country_code: 'CA',
|
|
526
|
+
bank_code: '0036', # 4 Financial Institution number
|
|
527
|
+
branch_code: '00063', # 5 digit Branch Transit number
|
|
528
|
+
account_number: '0123456' # 7 to 12 digits
|
|
529
|
+
)
|
|
530
|
+
iban.pseudo_iban # => "CAZZ003600063000000123456"
|
|
531
|
+
iban.iban # => nil
|
|
532
|
+
|
|
533
|
+
iban = Ibandit::IBAN.new('CAZZ003600063000000123456')
|
|
534
|
+
iban.country_code # => "CA"
|
|
535
|
+
iban.bank_code # => "0036"
|
|
536
|
+
iban.branch_code # => "00063"
|
|
537
|
+
iban.account_number # => "000000123456"
|
|
538
|
+
iban.iban # => nil
|
|
539
|
+
|
|
522
540
|
# New Zealand
|
|
523
541
|
iban = Ibandit::IBAN.new(
|
|
524
542
|
country_code: 'NZ',
|
data/ibandit.gemspec
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require File.expand_path("
|
|
3
|
+
require File.expand_path("lib/ibandit/version", __dir__)
|
|
4
4
|
|
|
5
5
|
Gem::Specification.new do |gem|
|
|
6
|
+
gem.add_development_dependency "gc_ruboconfig", "~> 2.3.11"
|
|
6
7
|
gem.add_development_dependency "nokogiri", "~> 1.6"
|
|
7
8
|
gem.add_development_dependency "pry", "~> 0.10"
|
|
8
9
|
gem.add_development_dependency "pry-nav", "~> 0.2"
|
|
9
10
|
gem.add_development_dependency "rspec", "~> 3.3"
|
|
10
11
|
gem.add_development_dependency "rspec-its", "~> 1.2"
|
|
11
|
-
gem.add_development_dependency "rubocop", "~> 0.52.0"
|
|
12
12
|
gem.add_development_dependency "sax-machine", "~> 1.3"
|
|
13
13
|
|
|
14
14
|
gem.add_runtime_dependency "i18n"
|
data/lib/ibandit.rb
CHANGED
|
@@ -14,8 +14,8 @@ require "ibandit/pseudo_iban_splitter"
|
|
|
14
14
|
require "ibandit/local_details_cleaner"
|
|
15
15
|
require "ibandit/check_digit"
|
|
16
16
|
|
|
17
|
-
I18n.load_path += Dir[File.expand_path("
|
|
18
|
-
|
|
17
|
+
I18n.load_path += Dir[File.expand_path("../config/locales/*.{rb,yml}",
|
|
18
|
+
__dir__)]
|
|
19
19
|
|
|
20
20
|
module Ibandit
|
|
21
21
|
class << self
|
|
@@ -28,7 +28,7 @@ module Ibandit
|
|
|
28
28
|
|
|
29
29
|
def structures
|
|
30
30
|
@structures ||= YAML.load_file(
|
|
31
|
-
File.expand_path("
|
|
31
|
+
File.expand_path("../data/structures.yml", __dir__),
|
|
32
32
|
)
|
|
33
33
|
end
|
|
34
34
|
|
|
@@ -7,7 +7,7 @@ module Ibandit
|
|
|
7
7
|
module GermanDetailsConverter
|
|
8
8
|
def self.rules
|
|
9
9
|
@rules ||= YAML.load_file(
|
|
10
|
-
File.expand_path("
|
|
10
|
+
File.expand_path("../../data/german_iban_rules.yml", __dir__),
|
|
11
11
|
)
|
|
12
12
|
end
|
|
13
13
|
|
|
@@ -41,8 +41,8 @@ module Ibandit
|
|
|
41
41
|
end
|
|
42
42
|
|
|
43
43
|
module PseudoAccountNumberBehaviour
|
|
44
|
-
def self.included(
|
|
45
|
-
|
|
44
|
+
def self.included(object)
|
|
45
|
+
object.extend(ClassMethods)
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
module ClassMethods
|
|
@@ -85,7 +85,9 @@ module Ibandit
|
|
|
85
85
|
end
|
|
86
86
|
|
|
87
87
|
def self.clean_ca_details(local_details)
|
|
88
|
-
local_details
|
|
88
|
+
return {} if local_details[:account_number].length < 7 # minimum length
|
|
89
|
+
|
|
90
|
+
{ account_number: local_details[:account_number].rjust(12, "0") }
|
|
89
91
|
end
|
|
90
92
|
|
|
91
93
|
def self.clean_bg_details(local_details)
|
data/lib/ibandit/version.rb
CHANGED
|
@@ -4,15 +4,15 @@ describe Ibandit::GermanDetailsConverter do
|
|
|
4
4
|
shared_examples "json based fixture" do |json_fixture_file|
|
|
5
5
|
json_fixture(json_fixture_file).each do |convertor|
|
|
6
6
|
context "Rule #{convertor['convertor']}" do
|
|
7
|
+
subject { test_subject }
|
|
8
|
+
|
|
7
9
|
let(:klass) do
|
|
8
10
|
described_class.const_get("Rule#{convertor['convertor']}")
|
|
9
11
|
end
|
|
10
12
|
|
|
11
|
-
subject { test_subject }
|
|
12
|
-
|
|
13
13
|
before do
|
|
14
|
-
|
|
15
|
-
and_call_original
|
|
14
|
+
allow_any_instance_of(klass).
|
|
15
|
+
to receive(:converted_details).and_call_original
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
convertor.fetch("valid", []).each do |tuple|
|
|
@@ -30,8 +30,9 @@ describe Ibandit::GermanDetailsConverter do
|
|
|
30
30
|
let(:converted_account_number) do
|
|
31
31
|
tuple["converted_account_number"] || account_number
|
|
32
32
|
end
|
|
33
|
+
|
|
33
34
|
it do
|
|
34
|
-
|
|
35
|
+
expect(subject).to eq(
|
|
35
36
|
bank_code: converted_bank_code,
|
|
36
37
|
account_number: converted_account_number,
|
|
37
38
|
)
|
|
@@ -44,6 +45,7 @@ describe Ibandit::GermanDetailsConverter do
|
|
|
44
45
|
"#{tuple['account_number']}" do
|
|
45
46
|
let(:bank_code) { tuple["bank_code"] || "00000000" }
|
|
46
47
|
let(:account_number) { tuple["account_number"] }
|
|
48
|
+
|
|
47
49
|
it "raises UnsupportedAccountDetails" do
|
|
48
50
|
expect { subject }.
|
|
49
51
|
to raise_error(Ibandit::UnsupportedAccountDetails)
|
|
@@ -88,6 +90,7 @@ describe Ibandit::GermanDetailsConverter do
|
|
|
88
90
|
valid_account_numbers.each do |number|
|
|
89
91
|
context number.to_s do
|
|
90
92
|
let(:account_number) { number }
|
|
93
|
+
|
|
91
94
|
it { is_expected.to be_valid }
|
|
92
95
|
end
|
|
93
96
|
end
|
|
@@ -95,6 +98,7 @@ describe Ibandit::GermanDetailsConverter do
|
|
|
95
98
|
invalid_account_numbers.each do |number|
|
|
96
99
|
context number.to_s do
|
|
97
100
|
let(:account_number) { number }
|
|
101
|
+
|
|
98
102
|
it { is_expected.to_not be_valid }
|
|
99
103
|
end
|
|
100
104
|
end
|
|
@@ -19,15 +19,18 @@ describe Ibandit::IBANAssembler do
|
|
|
19
19
|
|
|
20
20
|
describe ".assemble" do
|
|
21
21
|
subject(:assemble) { described_class.assemble(args) }
|
|
22
|
+
|
|
22
23
|
let(:args) { { country_code: "ES" } }
|
|
23
24
|
|
|
24
25
|
context "without a country_code" do
|
|
25
26
|
let(:args) { { bank_code: 1 } }
|
|
27
|
+
|
|
26
28
|
it { is_expected.to be_nil }
|
|
27
29
|
end
|
|
28
30
|
|
|
29
31
|
context "with an unsupported country_code" do
|
|
30
32
|
let(:args) { { country_code: "FU" } }
|
|
33
|
+
|
|
31
34
|
it { is_expected.to be_nil }
|
|
32
35
|
end
|
|
33
36
|
|
|
@@ -46,11 +49,13 @@ describe Ibandit::IBANAssembler do
|
|
|
46
49
|
|
|
47
50
|
context "without an account_number" do
|
|
48
51
|
before { args.delete(:account_number) }
|
|
52
|
+
|
|
49
53
|
it { is_expected.to be_nil }
|
|
50
54
|
end
|
|
51
55
|
|
|
52
56
|
context "without an bank_code" do
|
|
53
57
|
before { args.delete(:bank_code) }
|
|
58
|
+
|
|
54
59
|
it { is_expected.to be_nil }
|
|
55
60
|
end
|
|
56
61
|
end
|
|
@@ -64,6 +69,7 @@ describe Ibandit::IBANAssembler do
|
|
|
64
69
|
|
|
65
70
|
context "without an account_number" do
|
|
66
71
|
before { args.delete(:account_number) }
|
|
72
|
+
|
|
67
73
|
it { is_expected.to be_nil }
|
|
68
74
|
end
|
|
69
75
|
end
|
|
@@ -84,11 +90,13 @@ describe Ibandit::IBANAssembler do
|
|
|
84
90
|
|
|
85
91
|
context "without an account_number" do
|
|
86
92
|
before { args.delete(:account_number) }
|
|
93
|
+
|
|
87
94
|
it { is_expected.to be_nil }
|
|
88
95
|
end
|
|
89
96
|
|
|
90
97
|
context "without a bank_code" do
|
|
91
98
|
before { args.delete(:bank_code) }
|
|
99
|
+
|
|
92
100
|
it { is_expected.to be_nil }
|
|
93
101
|
end
|
|
94
102
|
end
|
|
@@ -109,16 +117,19 @@ describe Ibandit::IBANAssembler do
|
|
|
109
117
|
|
|
110
118
|
context "without an branch_code" do
|
|
111
119
|
before { args.delete(:branch_code) }
|
|
120
|
+
|
|
112
121
|
it { is_expected.to eq("CY040020000001200527600") }
|
|
113
122
|
end
|
|
114
123
|
|
|
115
124
|
context "without an account_number" do
|
|
116
125
|
before { args.delete(:account_number) }
|
|
126
|
+
|
|
117
127
|
it { is_expected.to be_nil }
|
|
118
128
|
end
|
|
119
129
|
|
|
120
130
|
context "without an bank_code" do
|
|
121
131
|
before { args.delete(:bank_code) }
|
|
132
|
+
|
|
122
133
|
it { is_expected.to be_nil }
|
|
123
134
|
end
|
|
124
135
|
end
|
|
@@ -138,11 +149,13 @@ describe Ibandit::IBANAssembler do
|
|
|
138
149
|
|
|
139
150
|
context "without a bank_code" do
|
|
140
151
|
before { args.delete(:bank_code) }
|
|
152
|
+
|
|
141
153
|
it { is_expected.to be_nil }
|
|
142
154
|
end
|
|
143
155
|
|
|
144
156
|
context "without an account_number" do
|
|
145
157
|
before { args.delete(:account_number) }
|
|
158
|
+
|
|
146
159
|
it { is_expected.to be_nil }
|
|
147
160
|
end
|
|
148
161
|
end
|
|
@@ -160,11 +173,13 @@ describe Ibandit::IBANAssembler do
|
|
|
160
173
|
|
|
161
174
|
context "without a bank_code" do
|
|
162
175
|
before { args.delete(:bank_code) }
|
|
176
|
+
|
|
163
177
|
it { is_expected.to be_nil }
|
|
164
178
|
end
|
|
165
179
|
|
|
166
180
|
context "without an account_number" do
|
|
167
181
|
before { args.delete(:account_number) }
|
|
182
|
+
|
|
168
183
|
it { is_expected.to be_nil }
|
|
169
184
|
end
|
|
170
185
|
end
|
|
@@ -182,11 +197,13 @@ describe Ibandit::IBANAssembler do
|
|
|
182
197
|
|
|
183
198
|
context "without a bank_code" do
|
|
184
199
|
before { args.delete(:bank_code) }
|
|
200
|
+
|
|
185
201
|
it { is_expected.to be_nil }
|
|
186
202
|
end
|
|
187
203
|
|
|
188
204
|
context "without an account_number" do
|
|
189
205
|
before { args.delete(:account_number) }
|
|
206
|
+
|
|
190
207
|
it { is_expected.to be_nil }
|
|
191
208
|
end
|
|
192
209
|
end
|
|
@@ -206,6 +223,7 @@ describe Ibandit::IBANAssembler do
|
|
|
206
223
|
|
|
207
224
|
context "without an account_number" do
|
|
208
225
|
before { args.delete(:account_number) }
|
|
226
|
+
|
|
209
227
|
it { is_expected.to be_nil }
|
|
210
228
|
end
|
|
211
229
|
end
|
|
@@ -226,7 +244,9 @@ describe Ibandit::IBANAssembler do
|
|
|
226
244
|
|
|
227
245
|
context "without a bank_code or branch code" do
|
|
228
246
|
before { args.delete(:bank_code) }
|
|
247
|
+
|
|
229
248
|
before { args.delete(:branch_code) }
|
|
249
|
+
|
|
230
250
|
before { args[:account_number] = "23100001180000012345" }
|
|
231
251
|
|
|
232
252
|
it { is_expected.to be_nil }
|
|
@@ -234,6 +254,7 @@ describe Ibandit::IBANAssembler do
|
|
|
234
254
|
|
|
235
255
|
context "without an account_number" do
|
|
236
256
|
before { args.delete(:account_number) }
|
|
257
|
+
|
|
237
258
|
it { is_expected.to be_nil }
|
|
238
259
|
end
|
|
239
260
|
end
|
|
@@ -249,11 +270,13 @@ describe Ibandit::IBANAssembler do
|
|
|
249
270
|
|
|
250
271
|
context "without an account_number" do
|
|
251
272
|
before { args.delete(:account_number) }
|
|
273
|
+
|
|
252
274
|
it { is_expected.to be_nil }
|
|
253
275
|
end
|
|
254
276
|
|
|
255
277
|
context "without a bank_code" do
|
|
256
278
|
before { args.delete(:bank_code) }
|
|
279
|
+
|
|
257
280
|
it { is_expected.to be_nil }
|
|
258
281
|
end
|
|
259
282
|
end
|
|
@@ -274,21 +297,25 @@ describe Ibandit::IBANAssembler do
|
|
|
274
297
|
|
|
275
298
|
context "without the rib key in the account number" do
|
|
276
299
|
before { args[:account_number] = "0500013M026" }
|
|
300
|
+
|
|
277
301
|
specify { expect(Ibandit::IBAN.new(assemble)).to_not be_valid }
|
|
278
302
|
end
|
|
279
303
|
|
|
280
304
|
context "without a bank_code" do
|
|
281
305
|
before { args.delete(:bank_code) }
|
|
306
|
+
|
|
282
307
|
it { is_expected.to be_nil }
|
|
283
308
|
end
|
|
284
309
|
|
|
285
310
|
context "without a branch_code" do
|
|
286
311
|
before { args.delete(:branch_code) }
|
|
312
|
+
|
|
287
313
|
it { is_expected.to be_nil }
|
|
288
314
|
end
|
|
289
315
|
|
|
290
316
|
context "without an account_number" do
|
|
291
317
|
before { args.delete(:account_number) }
|
|
318
|
+
|
|
292
319
|
it { is_expected.to be_nil }
|
|
293
320
|
end
|
|
294
321
|
end
|
|
@@ -309,26 +336,31 @@ describe Ibandit::IBANAssembler do
|
|
|
309
336
|
|
|
310
337
|
context "with the bank_code supplied manually" do
|
|
311
338
|
before { args.merge!(bank_code: "BARC") }
|
|
339
|
+
|
|
312
340
|
it { is_expected.to eq("GB07BARC20000000579135") }
|
|
313
341
|
end
|
|
314
342
|
|
|
315
343
|
context "without a branch_code" do
|
|
316
344
|
before { args.delete(:branch_code) }
|
|
345
|
+
|
|
317
346
|
it { is_expected.to be_nil }
|
|
318
347
|
end
|
|
319
348
|
|
|
320
349
|
context "without an account_number" do
|
|
321
350
|
before { args.delete(:account_number) }
|
|
351
|
+
|
|
322
352
|
it { is_expected.to be_nil }
|
|
323
353
|
end
|
|
324
354
|
|
|
325
355
|
context "without a bank_code" do
|
|
326
356
|
before { args.delete(:bank_code) }
|
|
357
|
+
|
|
327
358
|
it { is_expected.to be_nil }
|
|
328
359
|
end
|
|
329
360
|
|
|
330
361
|
context "with a non-numeric branch code" do
|
|
331
362
|
before { args[:branch_code] = "abc123" }
|
|
363
|
+
|
|
332
364
|
it { is_expected.to be_nil }
|
|
333
365
|
end
|
|
334
366
|
end
|
|
@@ -349,16 +381,19 @@ describe Ibandit::IBANAssembler do
|
|
|
349
381
|
|
|
350
382
|
context "without an account_number" do
|
|
351
383
|
before { args.delete(:account_number) }
|
|
384
|
+
|
|
352
385
|
it { is_expected.to be_nil }
|
|
353
386
|
end
|
|
354
387
|
|
|
355
388
|
context "without a bank_code" do
|
|
356
389
|
before { args.delete(:bank_code) }
|
|
390
|
+
|
|
357
391
|
it { is_expected.to be_nil }
|
|
358
392
|
end
|
|
359
393
|
|
|
360
394
|
context "without a branch_code" do
|
|
361
395
|
before { args.delete(:branch_code) }
|
|
396
|
+
|
|
362
397
|
it { is_expected.to be_nil }
|
|
363
398
|
end
|
|
364
399
|
end
|
|
@@ -376,11 +411,13 @@ describe Ibandit::IBANAssembler do
|
|
|
376
411
|
|
|
377
412
|
context "without a bank_code" do
|
|
378
413
|
before { args.delete(:bank_code) }
|
|
414
|
+
|
|
379
415
|
it { is_expected.to be_nil }
|
|
380
416
|
end
|
|
381
417
|
|
|
382
418
|
context "without an account_number" do
|
|
383
419
|
before { args.delete(:account_number) }
|
|
420
|
+
|
|
384
421
|
it { is_expected.to be_nil }
|
|
385
422
|
end
|
|
386
423
|
end
|
|
@@ -401,7 +438,9 @@ describe Ibandit::IBANAssembler do
|
|
|
401
438
|
|
|
402
439
|
context "without a bank_code or branch_code" do
|
|
403
440
|
before { args.delete(:bank_code) }
|
|
441
|
+
|
|
404
442
|
before { args.delete(:branch_code) }
|
|
443
|
+
|
|
405
444
|
before { args[:account_number] = "11773016-11111018-00000000" }
|
|
406
445
|
|
|
407
446
|
it { is_expected.to be_nil }
|
|
@@ -409,6 +448,7 @@ describe Ibandit::IBANAssembler do
|
|
|
409
448
|
|
|
410
449
|
context "without a bank_code" do
|
|
411
450
|
before { args.delete(:bank_code) }
|
|
451
|
+
|
|
412
452
|
before { args[:account_number] = "11773016-11111018-00000000" }
|
|
413
453
|
|
|
414
454
|
it { is_expected.to be_nil }
|
|
@@ -416,6 +456,7 @@ describe Ibandit::IBANAssembler do
|
|
|
416
456
|
|
|
417
457
|
context "without a branch_code" do
|
|
418
458
|
before { args.delete(:branch_code) }
|
|
459
|
+
|
|
419
460
|
before { args[:account_number] = "11773016-11111018-00000000" }
|
|
420
461
|
|
|
421
462
|
it { is_expected.to be_nil }
|
|
@@ -423,6 +464,7 @@ describe Ibandit::IBANAssembler do
|
|
|
423
464
|
|
|
424
465
|
context "without an account_number" do
|
|
425
466
|
before { args.delete(:account_number) }
|
|
467
|
+
|
|
426
468
|
it { is_expected.to be_nil }
|
|
427
469
|
end
|
|
428
470
|
end
|
|
@@ -441,16 +483,19 @@ describe Ibandit::IBANAssembler do
|
|
|
441
483
|
|
|
442
484
|
context "without a branch_code" do
|
|
443
485
|
before { args.delete(:branch_code) }
|
|
486
|
+
|
|
444
487
|
it { is_expected.to be_nil }
|
|
445
488
|
end
|
|
446
489
|
|
|
447
490
|
context "without an account_number" do
|
|
448
491
|
before { args.delete(:account_number) }
|
|
492
|
+
|
|
449
493
|
it { is_expected.to be_nil }
|
|
450
494
|
end
|
|
451
495
|
|
|
452
496
|
context "without a bank_code" do
|
|
453
497
|
before { args.delete(:bank_code) }
|
|
498
|
+
|
|
454
499
|
it { is_expected.to be_nil }
|
|
455
500
|
end
|
|
456
501
|
end
|
|
@@ -470,11 +515,13 @@ describe Ibandit::IBANAssembler do
|
|
|
470
515
|
|
|
471
516
|
context "without an account_number" do
|
|
472
517
|
before { args.delete(:account_number) }
|
|
518
|
+
|
|
473
519
|
it { is_expected.to be_nil }
|
|
474
520
|
end
|
|
475
521
|
|
|
476
522
|
context "without a bank_code" do
|
|
477
523
|
before { args.delete(:bank_code) }
|
|
524
|
+
|
|
478
525
|
it { is_expected.to be_nil }
|
|
479
526
|
end
|
|
480
527
|
end
|
|
@@ -495,31 +542,37 @@ describe Ibandit::IBANAssembler do
|
|
|
495
542
|
|
|
496
543
|
context "with an explicitly passed check digit" do
|
|
497
544
|
before { args[:check_digit] = "Y" }
|
|
545
|
+
|
|
498
546
|
it { is_expected.to eq("IT64Y0542811101000000123456") }
|
|
499
547
|
end
|
|
500
548
|
|
|
501
549
|
context "with a bad character in an odd position" do
|
|
502
550
|
before { args[:account_number] = "000000123h00" }
|
|
551
|
+
|
|
503
552
|
it { is_expected.to be_nil }
|
|
504
553
|
end
|
|
505
554
|
|
|
506
555
|
context "with a bad character in an even position" do
|
|
507
556
|
before { args[:account_number] = "0000001230h0" }
|
|
557
|
+
|
|
508
558
|
it { is_expected.to be_nil }
|
|
509
559
|
end
|
|
510
560
|
|
|
511
561
|
context "without a bank_code" do
|
|
512
562
|
before { args.delete(:bank_code) }
|
|
563
|
+
|
|
513
564
|
it { is_expected.to be_nil }
|
|
514
565
|
end
|
|
515
566
|
|
|
516
567
|
context "without a branch_code" do
|
|
517
568
|
before { args.delete(:branch_code) }
|
|
569
|
+
|
|
518
570
|
it { is_expected.to be_nil }
|
|
519
571
|
end
|
|
520
572
|
|
|
521
573
|
context "without an account_number" do
|
|
522
574
|
before { args.delete(:account_number) }
|
|
575
|
+
|
|
523
576
|
it { is_expected.to be_nil }
|
|
524
577
|
end
|
|
525
578
|
end
|
|
@@ -539,11 +592,13 @@ describe Ibandit::IBANAssembler do
|
|
|
539
592
|
|
|
540
593
|
context "without an account_number" do
|
|
541
594
|
before { args.delete(:account_number) }
|
|
595
|
+
|
|
542
596
|
it { is_expected.to be_nil }
|
|
543
597
|
end
|
|
544
598
|
|
|
545
599
|
context "without a bank_code" do
|
|
546
600
|
before { args.delete(:bank_code) }
|
|
601
|
+
|
|
547
602
|
it { is_expected.to be_nil }
|
|
548
603
|
end
|
|
549
604
|
end
|
|
@@ -563,11 +618,13 @@ describe Ibandit::IBANAssembler do
|
|
|
563
618
|
|
|
564
619
|
context "without an account_number" do
|
|
565
620
|
before { args.delete(:account_number) }
|
|
621
|
+
|
|
566
622
|
it { is_expected.to be_nil }
|
|
567
623
|
end
|
|
568
624
|
|
|
569
625
|
context "without a bank_code" do
|
|
570
626
|
before { args.delete(:bank_code) }
|
|
627
|
+
|
|
571
628
|
it { is_expected.to be_nil }
|
|
572
629
|
end
|
|
573
630
|
end
|
|
@@ -587,11 +644,13 @@ describe Ibandit::IBANAssembler do
|
|
|
587
644
|
|
|
588
645
|
context "without an account_number" do
|
|
589
646
|
before { args.delete(:account_number) }
|
|
647
|
+
|
|
590
648
|
it { is_expected.to be_nil }
|
|
591
649
|
end
|
|
592
650
|
|
|
593
651
|
context "without a bank_code" do
|
|
594
652
|
before { args.delete(:bank_code) }
|
|
653
|
+
|
|
595
654
|
it { is_expected.to be_nil }
|
|
596
655
|
end
|
|
597
656
|
end
|
|
@@ -612,21 +671,25 @@ describe Ibandit::IBANAssembler do
|
|
|
612
671
|
|
|
613
672
|
context "without the rib key in the account number" do
|
|
614
673
|
before { args[:account_number] = "0500013M026" }
|
|
674
|
+
|
|
615
675
|
specify { expect(Ibandit::IBAN.new(assemble)).to_not be_valid }
|
|
616
676
|
end
|
|
617
677
|
|
|
618
678
|
context "without a bank_code" do
|
|
619
679
|
before { args.delete(:bank_code) }
|
|
680
|
+
|
|
620
681
|
it { is_expected.to be_nil }
|
|
621
682
|
end
|
|
622
683
|
|
|
623
684
|
context "without a branch_code" do
|
|
624
685
|
before { args.delete(:branch_code) }
|
|
686
|
+
|
|
625
687
|
it { is_expected.to be_nil }
|
|
626
688
|
end
|
|
627
689
|
|
|
628
690
|
context "without an account_number" do
|
|
629
691
|
before { args.delete(:account_number) }
|
|
692
|
+
|
|
630
693
|
it { is_expected.to be_nil }
|
|
631
694
|
end
|
|
632
695
|
end
|
|
@@ -650,21 +713,25 @@ describe Ibandit::IBANAssembler do
|
|
|
650
713
|
|
|
651
714
|
context "without a branch_code" do
|
|
652
715
|
before { args.delete(:branch_code) }
|
|
716
|
+
|
|
653
717
|
it { is_expected.to be_nil }
|
|
654
718
|
end
|
|
655
719
|
|
|
656
720
|
context "without an account_number" do
|
|
657
721
|
before { args.delete(:account_number) }
|
|
722
|
+
|
|
658
723
|
it { is_expected.to be_nil }
|
|
659
724
|
end
|
|
660
725
|
|
|
661
726
|
context "without a bank_code" do
|
|
662
727
|
before { args.delete(:bank_code) }
|
|
728
|
+
|
|
663
729
|
it { is_expected.to be_nil }
|
|
664
730
|
end
|
|
665
731
|
|
|
666
732
|
context "with a non-numeric branch code" do
|
|
667
733
|
before { args[:branch_code] = "abc123" }
|
|
734
|
+
|
|
668
735
|
it { is_expected.to be_nil }
|
|
669
736
|
end
|
|
670
737
|
end
|
|
@@ -684,11 +751,13 @@ describe Ibandit::IBANAssembler do
|
|
|
684
751
|
|
|
685
752
|
context "without an account_number" do
|
|
686
753
|
before { args.delete(:account_number) }
|
|
754
|
+
|
|
687
755
|
it { is_expected.to be_nil }
|
|
688
756
|
end
|
|
689
757
|
|
|
690
758
|
context "without an bank_code" do
|
|
691
759
|
before { args.delete(:bank_code) }
|
|
760
|
+
|
|
692
761
|
it { is_expected.to be_nil }
|
|
693
762
|
end
|
|
694
763
|
end
|
|
@@ -708,6 +777,7 @@ describe Ibandit::IBANAssembler do
|
|
|
708
777
|
|
|
709
778
|
context "without a bank_code" do
|
|
710
779
|
before { args.delete(:bank_code) }
|
|
780
|
+
|
|
711
781
|
before { args[:account_number] = "86011117947" }
|
|
712
782
|
|
|
713
783
|
it { is_expected.to be_nil }
|
|
@@ -715,6 +785,7 @@ describe Ibandit::IBANAssembler do
|
|
|
715
785
|
|
|
716
786
|
context "without an account_number" do
|
|
717
787
|
before { args.delete(:account_number) }
|
|
788
|
+
|
|
718
789
|
it { is_expected.to be_nil }
|
|
719
790
|
end
|
|
720
791
|
end
|
|
@@ -734,6 +805,7 @@ describe Ibandit::IBANAssembler do
|
|
|
734
805
|
|
|
735
806
|
context "without a bank_code" do
|
|
736
807
|
before { args.delete(:bank_code) }
|
|
808
|
+
|
|
737
809
|
before { args[:account_number] = "60102010260000042270201111" }
|
|
738
810
|
|
|
739
811
|
it { is_expected.to be_nil }
|
|
@@ -741,6 +813,7 @@ describe Ibandit::IBANAssembler do
|
|
|
741
813
|
|
|
742
814
|
context "without an account_number" do
|
|
743
815
|
before { args.delete(:account_number) }
|
|
816
|
+
|
|
744
817
|
it { is_expected.to be_nil }
|
|
745
818
|
end
|
|
746
819
|
end
|
|
@@ -761,16 +834,19 @@ describe Ibandit::IBANAssembler do
|
|
|
761
834
|
|
|
762
835
|
context "without a bank_code" do
|
|
763
836
|
before { args.delete(:bank_code) }
|
|
837
|
+
|
|
764
838
|
it { is_expected.to be_nil }
|
|
765
839
|
end
|
|
766
840
|
|
|
767
841
|
context "without a branch_code" do
|
|
768
842
|
before { args.delete(:branch_code) }
|
|
843
|
+
|
|
769
844
|
it { is_expected.to be_nil }
|
|
770
845
|
end
|
|
771
846
|
|
|
772
847
|
context "without an account_number" do
|
|
773
848
|
before { args.delete(:account_number) }
|
|
849
|
+
|
|
774
850
|
it { is_expected.to be_nil }
|
|
775
851
|
end
|
|
776
852
|
end
|
|
@@ -790,11 +866,13 @@ describe Ibandit::IBANAssembler do
|
|
|
790
866
|
|
|
791
867
|
context "without an account_number" do
|
|
792
868
|
before { args.delete(:account_number) }
|
|
869
|
+
|
|
793
870
|
it { is_expected.to be_nil }
|
|
794
871
|
end
|
|
795
872
|
|
|
796
873
|
context "without a bank_code" do
|
|
797
874
|
before { args.delete(:bank_code) }
|
|
875
|
+
|
|
798
876
|
it { is_expected.to be_nil }
|
|
799
877
|
end
|
|
800
878
|
end
|
|
@@ -814,11 +892,13 @@ describe Ibandit::IBANAssembler do
|
|
|
814
892
|
|
|
815
893
|
context "without a bank_code" do
|
|
816
894
|
before { args.delete(:bank_code) }
|
|
895
|
+
|
|
817
896
|
it { is_expected.to be_nil }
|
|
818
897
|
end
|
|
819
898
|
|
|
820
899
|
context "without an account_number" do
|
|
821
900
|
before { args.delete(:account_number) }
|
|
901
|
+
|
|
822
902
|
it { is_expected.to be_nil }
|
|
823
903
|
end
|
|
824
904
|
end
|
|
@@ -838,11 +918,13 @@ describe Ibandit::IBANAssembler do
|
|
|
838
918
|
|
|
839
919
|
context "without a bank_code" do
|
|
840
920
|
before { args.delete(:bank_code) }
|
|
921
|
+
|
|
841
922
|
it { is_expected.to be_nil }
|
|
842
923
|
end
|
|
843
924
|
|
|
844
925
|
context "without an account_number" do
|
|
845
926
|
before { args.delete(:account_number) }
|
|
927
|
+
|
|
846
928
|
it { is_expected.to be_nil }
|
|
847
929
|
end
|
|
848
930
|
end
|
|
@@ -862,11 +944,13 @@ describe Ibandit::IBANAssembler do
|
|
|
862
944
|
|
|
863
945
|
context "without a bank_code" do
|
|
864
946
|
before { args.delete(:bank_code) }
|
|
947
|
+
|
|
865
948
|
it { is_expected.to be_nil }
|
|
866
949
|
end
|
|
867
950
|
|
|
868
951
|
context "without an account_number" do
|
|
869
952
|
before { args.delete(:account_number) }
|
|
953
|
+
|
|
870
954
|
it { is_expected.to be_nil }
|
|
871
955
|
end
|
|
872
956
|
end
|
|
@@ -887,16 +971,19 @@ describe Ibandit::IBANAssembler do
|
|
|
887
971
|
|
|
888
972
|
context "without a bank_code" do
|
|
889
973
|
before { args.delete(:bank_code) }
|
|
974
|
+
|
|
890
975
|
it { is_expected.to be_nil }
|
|
891
976
|
end
|
|
892
977
|
|
|
893
978
|
context "without a branch_code" do
|
|
894
979
|
before { args.delete(:branch_code) }
|
|
980
|
+
|
|
895
981
|
it { is_expected.to be_nil }
|
|
896
982
|
end
|
|
897
983
|
|
|
898
984
|
context "without an account_number" do
|
|
899
985
|
before { args.delete(:account_number) }
|
|
986
|
+
|
|
900
987
|
it { is_expected.to be_nil }
|
|
901
988
|
end
|
|
902
989
|
end
|