ibandit 0.11.6 → 0.11.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,228 +1,228 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe Ibandit::Sweden::Validator do
4
- describe '.bank_code_exists_for_clearing_code?' do
4
+ describe ".bank_code_exists_for_clearing_code?" do
5
5
  subject do
6
6
  described_class.bank_code_exists_for_clearing_code?(clearing_code)
7
7
  end
8
8
 
9
- context 'without a clearing code' do
9
+ context "without a clearing code" do
10
10
  let(:clearing_code) { nil }
11
11
  it { is_expected.to eq(false) }
12
12
  end
13
13
 
14
- context 'with an impossible clearing code' do
15
- let(:clearing_code) { '1001' }
14
+ context "with an impossible clearing code" do
15
+ let(:clearing_code) { "1001" }
16
16
  it { is_expected.to eq(false) }
17
17
  end
18
18
 
19
- context 'with a possible clearing code' do
20
- let(:clearing_code) { '1101' }
19
+ context "with a possible clearing code" do
20
+ let(:clearing_code) { "1101" }
21
21
  it { is_expected.to eq(true) }
22
22
  end
23
23
  end
24
24
 
25
- describe '.valid_clearing_code_length?' do
25
+ describe ".valid_clearing_code_length?" do
26
26
  subject { described_class.valid_clearing_code_length?(clearing_code) }
27
27
 
28
- context 'without a clearing code' do
28
+ context "without a clearing code" do
29
29
  let(:clearing_code) { nil }
30
30
  it { is_expected.to eq(nil) }
31
31
  end
32
32
 
33
- context 'with an impossible clearing code' do
34
- let(:clearing_code) { '1001' }
33
+ context "with an impossible clearing code" do
34
+ let(:clearing_code) { "1001" }
35
35
  it { is_expected.to eq(nil) }
36
36
  end
37
37
 
38
- context 'with a correct length 4-digit clearing code' do
39
- let(:clearing_code) { '1101' }
38
+ context "with a correct length 4-digit clearing code" do
39
+ let(:clearing_code) { "1101" }
40
40
  it { is_expected.to eq(true) }
41
41
  end
42
42
 
43
- context 'with a correct length 5-digit clearing code' do
44
- let(:clearing_code) { '80001' }
43
+ context "with a correct length 5-digit clearing code" do
44
+ let(:clearing_code) { "80001" }
45
45
  it { is_expected.to eq(true) }
46
46
  end
47
47
 
48
- context 'with an incorrect length 5-digit clearing code' do
49
- let(:clearing_code) { '40001' }
48
+ context "with an incorrect length 5-digit clearing code" do
49
+ let(:clearing_code) { "40001" }
50
50
  it { is_expected.to eq(false) }
51
51
  end
52
52
  end
53
53
 
54
- describe '.valid_serial_number_length?' do
54
+ describe ".valid_serial_number_length?" do
55
55
  subject do
56
56
  described_class.valid_serial_number_length?(clearing_code: clearing_code,
57
57
  serial_number: serial_number)
58
58
  end
59
59
 
60
- context 'without a clearing code' do
60
+ context "without a clearing code" do
61
61
  let(:clearing_code) { nil }
62
- let(:serial_number) { '1234567' }
62
+ let(:serial_number) { "1234567" }
63
63
  it { is_expected.to eq(nil) }
64
64
  end
65
65
 
66
- context 'with an impossible clearing code' do
67
- let(:clearing_code) { '1001' }
68
- let(:serial_number) { '1234567' }
66
+ context "with an impossible clearing code" do
67
+ let(:clearing_code) { "1001" }
68
+ let(:serial_number) { "1234567" }
69
69
  it { is_expected.to eq(nil) }
70
70
  end
71
71
 
72
- context 'with a correct length serial number' do
73
- let(:clearing_code) { '1101' }
74
- let(:serial_number) { '1234567' }
72
+ context "with a correct length serial number" do
73
+ let(:clearing_code) { "1101" }
74
+ let(:serial_number) { "1234567" }
75
75
  it { is_expected.to eq(true) }
76
76
  end
77
77
 
78
- context 'with an incorrect length serial number' do
79
- let(:clearing_code) { '1101' }
80
- let(:serial_number) { '123456' }
78
+ context "with an incorrect length serial number" do
79
+ let(:clearing_code) { "1101" }
80
+ let(:serial_number) { "123456" }
81
81
  it { is_expected.to eq(false) }
82
82
  end
83
83
 
84
- context 'with a short serial number for a clearing code that zerofills' do
85
- let(:clearing_code) { '9960' }
86
- let(:serial_number) { '123456' }
84
+ context "with a short serial number for a clearing code that zerofills" do
85
+ let(:clearing_code) { "9960" }
86
+ let(:serial_number) { "123456" }
87
87
  it { is_expected.to eq(true) }
88
88
  end
89
89
 
90
- context 'with a long serial number for a clearing code that zerofills' do
91
- let(:clearing_code) { '9960' }
92
- let(:serial_number) { '12345678901' }
90
+ context "with a long serial number for a clearing code that zerofills" do
91
+ let(:clearing_code) { "9960" }
92
+ let(:serial_number) { "12345678901" }
93
93
  it { is_expected.to eq(false) }
94
94
  end
95
95
 
96
- context 'without a serial number' do
97
- let(:clearing_code) { '9960' }
96
+ context "without a serial number" do
97
+ let(:clearing_code) { "9960" }
98
98
  let(:serial_number) { nil }
99
99
  it { is_expected.to eq(false) }
100
100
  end
101
101
  end
102
102
 
103
- describe '.bank_code_exists?' do
103
+ describe ".bank_code_exists?" do
104
104
  subject { described_class.bank_code_exists?(bank_code) }
105
105
 
106
- context 'without a bank code' do
106
+ context "without a bank code" do
107
107
  let(:bank_code) { nil }
108
108
  it { is_expected.to eq(false) }
109
109
  end
110
110
 
111
- context 'with an impossible bank code' do
112
- let(:bank_code) { '123' }
111
+ context "with an impossible bank code" do
112
+ let(:bank_code) { "123" }
113
113
  it { is_expected.to eq(false) }
114
114
  end
115
115
 
116
- context 'with a possible bank code' do
117
- let(:bank_code) { '120' }
116
+ context "with a possible bank code" do
117
+ let(:bank_code) { "120" }
118
118
  it { is_expected.to eq(true) }
119
119
  end
120
120
  end
121
121
 
122
- describe '.bank_code_possible_for_account_number?' do
122
+ describe ".bank_code_possible_for_account_number?" do
123
123
  subject do
124
124
  described_class.bank_code_possible_for_account_number?(
125
125
  bank_code: bank_code,
126
- account_number: account_number
126
+ account_number: account_number,
127
127
  )
128
128
  end
129
129
 
130
- context 'without a bank code' do
131
- let(:account_number) { '12810105723' }
130
+ context "without a bank code" do
131
+ let(:account_number) { "12810105723" }
132
132
  let(:bank_code) { nil }
133
133
  it { is_expected.to eq(nil) }
134
134
  end
135
135
 
136
- context 'with an impossible bank code' do
137
- let(:account_number) { '12810105723' }
138
- let(:bank_code) { '500' }
136
+ context "with an impossible bank code" do
137
+ let(:account_number) { "12810105723" }
138
+ let(:bank_code) { "500" }
139
139
  it { is_expected.to eq(false) }
140
140
  end
141
141
 
142
- context 'with a possible bank code' do
143
- let(:account_number) { '12810105723' }
144
- let(:bank_code) { '120' }
142
+ context "with a possible bank code" do
143
+ let(:account_number) { "12810105723" }
144
+ let(:bank_code) { "120" }
145
145
  it { is_expected.to eq(true) }
146
146
  end
147
147
  end
148
148
 
149
- describe '.account_number_length_valid_for_bank_code?' do
149
+ describe ".account_number_length_valid_for_bank_code?" do
150
150
  subject do
151
151
  described_class.account_number_length_valid_for_bank_code?(
152
152
  bank_code: bank_code,
153
- account_number: account_number
153
+ account_number: account_number,
154
154
  )
155
155
  end
156
156
 
157
- context 'without a bank code' do
158
- let(:account_number) { '12810105723' }
157
+ context "without a bank code" do
158
+ let(:account_number) { "12810105723" }
159
159
  let(:bank_code) { nil }
160
160
  it { is_expected.to eq(nil) }
161
161
  end
162
162
 
163
- context 'with an impossible bank code' do
164
- let(:account_number) { '12810105723' }
165
- let(:bank_code) { '500' }
163
+ context "with an impossible bank code" do
164
+ let(:account_number) { "12810105723" }
165
+ let(:bank_code) { "500" }
166
166
  it { is_expected.to eq(nil) }
167
167
  end
168
168
 
169
- context 'with a normal type-1 account number' do
170
- let(:account_number) { '00000054391024039' }
171
- let(:bank_code) { '500' }
169
+ context "with a normal type-1 account number" do
170
+ let(:account_number) { "00000054391024039" }
171
+ let(:bank_code) { "500" }
172
172
  it { is_expected.to eq(true) }
173
173
 
174
- context 'that has a 6 digit serial number' do
175
- let(:account_number) { '00000005439102403' }
176
- let(:bank_code) { '500' }
174
+ context "that has a 6 digit serial number" do
175
+ let(:account_number) { "00000005439102403" }
176
+ let(:bank_code) { "500" }
177
177
  it { is_expected.to eq(false) }
178
178
  end
179
179
 
180
- context 'that has an 8 digit serial number' do
181
- let(:account_number) { '00000543910240391' }
182
- let(:bank_code) { '500' }
180
+ context "that has an 8 digit serial number" do
181
+ let(:account_number) { "00000543910240391" }
182
+ let(:bank_code) { "500" }
183
183
  it { is_expected.to eq(false) }
184
184
  end
185
185
  end
186
186
 
187
- context 'with a Danske bank account' do
188
- let(:account_number) { '12810105723' }
189
- let(:bank_code) { '120' }
187
+ context "with a Danske bank account" do
188
+ let(:account_number) { "12810105723" }
189
+ let(:bank_code) { "120" }
190
190
  it { is_expected.to eq(true) }
191
191
 
192
- context 'that has an 8 digit serial number' do
193
- let(:account_number) { '00000128101057231' }
194
- let(:bank_code) { '120' }
192
+ context "that has an 8 digit serial number" do
193
+ let(:account_number) { "00000128101057231" }
194
+ let(:bank_code) { "120" }
195
195
  it { is_expected.to eq(false) }
196
196
  end
197
197
 
198
- context 'that has a 6 digit serial number' do
199
- let(:account_number) { '00000001281010572' }
200
- let(:bank_code) { '120' }
198
+ context "that has a 6 digit serial number" do
199
+ let(:account_number) { "00000001281010572" }
200
+ let(:bank_code) { "120" }
201
201
  # This passes because it could be a 10 digit account number from the
202
202
  # clearing code range 9180-9189.
203
203
  it { is_expected.to eq(true) }
204
204
  end
205
205
  end
206
206
 
207
- context 'with a Handelsbanken account number' do
208
- let(:bank_code) { '600' }
209
- let(:account_number) { '00000000219161038' }
207
+ context "with a Handelsbanken account number" do
208
+ let(:bank_code) { "600" }
209
+ let(:account_number) { "00000000219161038" }
210
210
  it { is_expected.to eq(true) }
211
211
 
212
- context 'that is only 8 characters long' do
213
- let(:account_number) { '00000000021916103' }
212
+ context "that is only 8 characters long" do
213
+ let(:account_number) { "00000000021916103" }
214
214
  it { is_expected.to eq(true) }
215
215
  end
216
216
 
217
- context 'that is 10 characters long' do
218
- let(:account_number) { '00000002191610381' }
217
+ context "that is 10 characters long" do
218
+ let(:account_number) { "00000002191610381" }
219
219
  it { is_expected.to eq(false) }
220
220
  end
221
221
  end
222
222
 
223
- context 'without a Nordea PlusGirot account number' do
224
- let(:bank_code) { '950' }
225
- let(:account_number) { '00099603401258276' }
223
+ context "without a Nordea PlusGirot account number" do
224
+ let(:bank_code) { "950" }
225
+ let(:account_number) { "00099603401258276" }
226
226
  it { is_expected.to eq(true) }
227
227
  end
228
228
  end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,6 @@
1
- require 'ibandit'
2
- require 'rspec/its'
3
- require 'json'
1
+ require "ibandit"
2
+ require "rspec/its"
3
+ require "json"
4
4
 
5
5
  RSpec.configure do |config|
6
6
  config.mock_with(:rspec) { |mocks| mocks.verify_partial_doubles = true }
@@ -11,30 +11,30 @@ def json_fixture(filename)
11
11
  JSON.parse(File.read("spec/fixtures/#{filename}.json"))
12
12
  end
13
13
 
14
- RSpec.shared_context 'locale en', locale: :en do
14
+ RSpec.shared_context "locale en", locale: :en do
15
15
  around { |example| I18n.with_locale(:en) { example.run } }
16
16
  end
17
17
 
18
- RSpec.shared_context 'locale fr', locale: :fr do
18
+ RSpec.shared_context "locale fr", locale: :fr do
19
19
  around { |example| I18n.with_locale(:fr) { example.run } }
20
20
  end
21
21
 
22
- RSpec.shared_context 'locale de', locale: :de do
22
+ RSpec.shared_context "locale de", locale: :de do
23
23
  around { |example| I18n.with_locale(:de) { example.run } }
24
24
  end
25
25
 
26
- RSpec.shared_context 'locale pt', locale: :pt do
26
+ RSpec.shared_context "locale pt", locale: :pt do
27
27
  around { |example| I18n.with_locale(:pt) { example.run } }
28
28
  end
29
29
 
30
- RSpec.shared_context 'locale es', locale: :es do
30
+ RSpec.shared_context "locale es", locale: :es do
31
31
  around { |example| I18n.with_locale(:es) { example.run } }
32
32
  end
33
33
 
34
- RSpec.shared_context 'locale it', locale: :it do
34
+ RSpec.shared_context "locale it", locale: :it do
35
35
  around { |example| I18n.with_locale(:it) { example.run } }
36
36
  end
37
37
 
38
- RSpec.shared_context 'locale nl', locale: :nl do
38
+ RSpec.shared_context "locale nl", locale: :nl do
39
39
  around { |example| I18n.with_locale(:nl) { example.run } }
40
40
  end
metadata CHANGED
@@ -1,85 +1,113 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ibandit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.6
4
+ version: 0.11.7
5
5
  platform: ruby
6
6
  authors:
7
- - Grey Baker
7
+ - GoCardless
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-17 00:00:00.000000000 Z
11
+ date: 2017-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rspec
14
+ name: nokogiri
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.3'
19
+ version: '1.6'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '3.3'
26
+ version: '1.6'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rspec-its
28
+ name: pry
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.2'
33
+ version: '0.10'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.2'
40
+ version: '0.10'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rubocop
42
+ name: pry-nav
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.33.0
47
+ version: '0.2'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.33.0
54
+ version: '0.2'
55
55
  - !ruby/object:Gem::Dependency
56
- name: sax-machine
56
+ name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.3'
61
+ version: '3.3'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.3'
68
+ version: '3.3'
69
69
  - !ruby/object:Gem::Dependency
70
- name: nokogiri
70
+ name: rspec-its
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.6'
75
+ version: '1.2'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.6'
82
+ version: '1.2'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 0.52.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 0.52.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: sax-machine
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.3'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.3'
83
111
  - !ruby/object:Gem::Dependency
84
112
  name: i18n
85
113
  requirement: !ruby/object:Gem::Requirement
@@ -98,7 +126,7 @@ description: Ibandit is a Ruby library for manipulating and validating IBANs. It
98
126
  you to construct an IBAN from national banking details; deconstruct an IBAN into
99
127
  national banking details; and validate an IBAN's check digits and format.
100
128
  email:
101
- - grey@gocardless.com
129
+ - developers@gocardless.com
102
130
  executables: []
103
131
  extensions: []
104
132
  extra_rdoc_files: []
@@ -177,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
205
  version: '0'
178
206
  requirements: []
179
207
  rubyforge_project:
180
- rubygems_version: 2.6.11
208
+ rubygems_version: 2.6.13
181
209
  signing_key:
182
210
  specification_version: 4
183
211
  summary: Convert national banking details into IBANs, and vice-versa.