valvat 1.0.1 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/.github/workflows/ruby.yml +41 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +15 -0
- data/CHANGES.md +27 -1
- data/Gemfile +2 -0
- data/Guardfile +6 -4
- data/README.md +6 -4
- data/Rakefile +3 -1
- data/certs/yolk.pem +25 -24
- data/gemfiles/activemodel-5 +1 -1
- data/gemfiles/activemodel-6 +1 -1
- data/gemfiles/{activemodel-3-2 → activemodel-7} +2 -2
- data/lib/active_model/validations/valvat_validator.rb +65 -32
- data/lib/valvat/checksum/at.rb +3 -1
- data/lib/valvat/checksum/be.rb +3 -1
- data/lib/valvat/checksum/bg.rb +17 -17
- data/lib/valvat/checksum/cy.rb +2 -0
- data/lib/valvat/checksum/de.rb +5 -3
- data/lib/valvat/checksum/dk.rb +3 -1
- data/lib/valvat/checksum/ee.rb +2 -0
- data/lib/valvat/checksum/es.rb +14 -16
- data/lib/valvat/checksum/fi.rb +3 -1
- data/lib/valvat/checksum/fr.rb +4 -2
- data/lib/valvat/checksum/gb.rb +46 -31
- data/lib/valvat/checksum/gr.rb +4 -2
- data/lib/valvat/checksum/hr.rb +2 -0
- data/lib/valvat/checksum/hu.rb +2 -0
- data/lib/valvat/checksum/ie.rb +5 -6
- data/lib/valvat/checksum/it.rb +7 -5
- data/lib/valvat/checksum/lt.rb +2 -0
- data/lib/valvat/checksum/lu.rb +3 -1
- data/lib/valvat/checksum/mt.rb +2 -0
- data/lib/valvat/checksum/nl.rb +5 -3
- data/lib/valvat/checksum/pl.rb +3 -1
- data/lib/valvat/checksum/pt.rb +3 -1
- data/lib/valvat/checksum/ro.rb +2 -0
- data/lib/valvat/checksum/se.rb +5 -3
- data/lib/valvat/checksum/si.rb +4 -2
- data/lib/valvat/checksum.rb +24 -28
- data/lib/valvat/error.rb +8 -2
- data/lib/valvat/local.rb +6 -4
- data/lib/valvat/locales/de.yml +2 -1
- data/lib/valvat/locales/en.yml +2 -1
- data/lib/valvat/locales/es.yml +1 -0
- data/lib/valvat/locales/fr.yml +1 -0
- data/lib/valvat/locales/hu.yml +1 -0
- data/lib/valvat/locales/nl.yml +1 -0
- data/lib/valvat/locales/pl.yml +1 -0
- data/lib/valvat/lookup/fault.rb +29 -21
- data/lib/valvat/lookup/request.rb +21 -16
- data/lib/valvat/lookup/response.rb +11 -10
- data/lib/valvat/lookup.rb +5 -4
- data/lib/valvat/syntax.rb +31 -30
- data/lib/valvat/utils.rb +12 -9
- data/lib/valvat/version.rb +3 -1
- data/lib/valvat.rb +4 -2
- data/spec/active_model/validations/valvat_validator_spec.rb +99 -93
- data/spec/spec_helper.rb +8 -8
- data/spec/valvat/checksum/at_spec.rb +6 -4
- data/spec/valvat/checksum/be_spec.rb +6 -4
- data/spec/valvat/checksum/bg_spec.rb +7 -4
- data/spec/valvat/checksum/cy_spec.rb +3 -1
- data/spec/valvat/checksum/de_spec.rb +6 -4
- data/spec/valvat/checksum/dk_spec.rb +6 -4
- data/spec/valvat/checksum/ee_spec.rb +3 -1
- data/spec/valvat/checksum/es_spec.rb +7 -4
- data/spec/valvat/checksum/fi_spec.rb +6 -4
- data/spec/valvat/checksum/fr_spec.rb +6 -4
- data/spec/valvat/checksum/gb_spec.rb +4 -2
- data/spec/valvat/checksum/gr_spec.rb +6 -4
- data/spec/valvat/checksum/hr_spec.rb +3 -1
- data/spec/valvat/checksum/hu_spec.rb +3 -1
- data/spec/valvat/checksum/ie_spec.rb +8 -6
- data/spec/valvat/checksum/it_spec.rb +10 -8
- data/spec/valvat/checksum/lt_spec.rb +3 -1
- data/spec/valvat/checksum/lu_spec.rb +6 -4
- data/spec/valvat/checksum/mt_spec.rb +3 -1
- data/spec/valvat/checksum/nl_spec.rb +9 -7
- data/spec/valvat/checksum/pl_spec.rb +8 -6
- data/spec/valvat/checksum/pt_spec.rb +10 -11
- data/spec/valvat/checksum/ro_spec.rb +3 -1
- data/spec/valvat/checksum/se_spec.rb +8 -6
- data/spec/valvat/checksum/si_spec.rb +10 -8
- data/spec/valvat/checksum_spec.rb +24 -9
- data/spec/valvat/lookup/fault_spec.rb +34 -0
- data/spec/valvat/lookup/request_spec.rb +32 -0
- data/spec/valvat/lookup/response_spec.rb +29 -0
- data/spec/valvat/lookup_spec.rb +171 -152
- data/spec/valvat/syntax_spec.rb +59 -280
- data/spec/valvat/utils_spec.rb +64 -47
- data/spec/valvat_spec.rb +140 -152
- data/valvat.gemspec +17 -17
- data.tar.gz.sig +1 -2
- metadata +48 -50
- metadata.gz.sig +0 -0
- data/.travis.yml +0 -47
- data/gemfiles/activemodel-4 +0 -7
- data/gemfiles/before-ruby21/activemodel-3-2 +0 -8
- data/gemfiles/before-ruby21/activemodel-4 +0 -8
- data/gemfiles/before-ruby21/standalone +0 -7
- data/spec/valvat/lockup/fault_spec.rb +0 -32
- data/spec/valvat/lockup/request_spec.rb +0 -15
- data/spec/valvat/lockup/response_spec.rb +0 -27
data/spec/valvat_spec.rb
CHANGED
@@ -1,229 +1,218 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'spec_helper'
|
4
4
|
|
5
5
|
describe Valvat do
|
6
|
-
describe
|
7
|
-
it
|
8
|
-
expect{
|
9
|
-
expect{
|
10
|
-
expect{
|
6
|
+
describe '#new' do
|
7
|
+
it 'demands one and only one argument' do
|
8
|
+
expect { described_class.new }.to raise_error(ArgumentError)
|
9
|
+
expect { described_class.new('a', 'b') }.to raise_error(ArgumentError)
|
10
|
+
expect { described_class.new('a') }.not_to raise_error
|
11
11
|
end
|
12
12
|
|
13
|
-
it
|
14
|
-
expect(
|
15
|
-
expect(
|
13
|
+
it 'normalizes input string' do
|
14
|
+
expect(described_class.new('de25.9597,69 7').to_s).to eql('DE259597697')
|
15
|
+
expect(described_class.new('de25.9597,69 7').iso_country_code).to eql('DE')
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
it
|
21
|
-
expect(Valvat(
|
19
|
+
describe 'Valvat()' do
|
20
|
+
it 'initializes new Valvat instance on string' do
|
21
|
+
expect(Valvat('abc')).to be_kind_of(described_class)
|
22
22
|
end
|
23
23
|
|
24
|
-
it
|
25
|
-
vat =
|
26
|
-
expect(Valvat(vat)).to be_kind_of(
|
24
|
+
it 'returns same Valvat instance on Valvat instance' do
|
25
|
+
vat = described_class.new('abc')
|
26
|
+
expect(Valvat(vat)).to be_kind_of(described_class)
|
27
27
|
expect(Valvat(vat).object_id).to eql(vat.object_id)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
it "returns true when when initialized with nil" do
|
35
|
-
expect(Valvat.new(nil)).to be_blank
|
31
|
+
describe '#blank?' do
|
32
|
+
it 'returns true when when initialized with nil' do
|
33
|
+
expect(described_class.new(nil)).to be_blank
|
36
34
|
end
|
37
35
|
|
38
|
-
it
|
39
|
-
expect(
|
36
|
+
it 'returns true when when initialized with an empty string' do
|
37
|
+
expect(described_class.new(' ')).to be_blank
|
40
38
|
end
|
41
39
|
|
42
|
-
it
|
43
|
-
expect(
|
40
|
+
it 'returns false when initialized with a value' do
|
41
|
+
expect(described_class.new('DE259597697')).not_to be_blank
|
44
42
|
end
|
45
43
|
end
|
46
44
|
|
47
|
-
context
|
48
|
-
let(:de_vat) {
|
49
|
-
let(:invalid_checksum) {
|
50
|
-
let(:at_vat) {
|
51
|
-
let(:gr_vat) {
|
45
|
+
context 'with european VAT number' do
|
46
|
+
let(:de_vat) { described_class.new('DE259597697') } # valid & exists
|
47
|
+
let(:invalid_checksum) { described_class.new('DE259597687') } # valid & invalid checksum
|
48
|
+
let(:at_vat) { described_class.new('ATU458890031') } # invalid
|
49
|
+
let(:gr_vat) { described_class.new('EL999943280') } # valid & exists
|
52
50
|
|
53
|
-
describe
|
54
|
-
it
|
51
|
+
describe '#valid?' do
|
52
|
+
it 'returns true on valid numbers' do
|
55
53
|
expect(de_vat).to be_valid
|
56
54
|
expect(gr_vat).to be_valid
|
57
55
|
end
|
58
56
|
|
59
|
-
it
|
57
|
+
it 'returns false on invalid numbers' do
|
60
58
|
expect(at_vat).not_to be_valid
|
61
59
|
end
|
62
60
|
end
|
63
61
|
|
64
|
-
describe
|
65
|
-
it
|
62
|
+
describe '#valid_checksum?' do
|
63
|
+
it 'returns true on valid numbers' do
|
66
64
|
expect(de_vat).to be_valid_checksum
|
67
65
|
expect(gr_vat).to be_valid_checksum
|
68
66
|
end
|
69
67
|
|
70
|
-
it
|
68
|
+
it 'returns false on invalid numbers' do
|
71
69
|
expect(at_vat).not_to be_valid_checksum
|
72
70
|
expect(invalid_checksum).not_to be_valid_checksum
|
73
71
|
end
|
74
72
|
end
|
75
73
|
|
76
|
-
describe
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
expect(de_vat.exists?).to eql(true)
|
84
|
-
expect(gr_vat.exists?).to eql(true)
|
85
|
-
expect(de_vat.exist?).to eql(true)
|
86
|
-
expect(gr_vat.exist?).to eql(true)
|
87
|
-
end
|
74
|
+
describe '#exist(s)?' do
|
75
|
+
it 'returns true with existing VAT numbers' do
|
76
|
+
allow(Valvat::Lookup).to receive_messages(validate: true)
|
77
|
+
expect(de_vat.exists?).to be(true)
|
78
|
+
expect(gr_vat.exists?).to be(true)
|
79
|
+
expect(de_vat.exist?).to be(true)
|
80
|
+
expect(gr_vat.exist?).to be(true)
|
88
81
|
end
|
89
82
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
it "returns false" do
|
96
|
-
expect(at_vat.exists?).to eql(false)
|
97
|
-
expect(at_vat.exist?).to eql(false)
|
98
|
-
end
|
83
|
+
it 'returns false with not existing VAT numbers' do
|
84
|
+
allow(Valvat::Lookup).to receive_messages(validate: false)
|
85
|
+
expect(at_vat.exists?).to be(false)
|
86
|
+
expect(at_vat.exist?).to be(false)
|
99
87
|
end
|
100
88
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
89
|
+
it 'calls Valvat::Lookup.validate with options' do
|
90
|
+
allow(Valvat::Lookup).to receive_messages(validate: true)
|
91
|
+
expect(de_vat.exists?(detail: true, bla: 'blupp')).to be(true)
|
92
|
+
expect(Valvat::Lookup).to have_received(:validate).once.with(
|
93
|
+
de_vat, detail: true, bla: 'blupp'
|
94
|
+
)
|
106
95
|
end
|
107
96
|
end
|
108
97
|
|
109
|
-
describe
|
110
|
-
it
|
111
|
-
expect(de_vat.iso_country_code).to eql(
|
112
|
-
expect(at_vat.iso_country_code).to eql(
|
98
|
+
describe '#iso_country_code' do
|
99
|
+
it 'returns iso country code on iso_country_code' do
|
100
|
+
expect(de_vat.iso_country_code).to eql('DE')
|
101
|
+
expect(at_vat.iso_country_code).to eql('AT')
|
113
102
|
end
|
114
103
|
|
115
|
-
it
|
116
|
-
expect(gr_vat.iso_country_code).to eql(
|
104
|
+
it 'returns GR iso country code on greek VAT number' do
|
105
|
+
expect(gr_vat.iso_country_code).to eql('GR')
|
117
106
|
end
|
118
107
|
end
|
119
108
|
|
120
|
-
describe
|
121
|
-
it
|
122
|
-
expect(de_vat.vat_country_code).to eql(
|
123
|
-
expect(at_vat.vat_country_code).to eql(
|
109
|
+
describe '#vat_country_code' do
|
110
|
+
it 'returns iso country code on iso_country_code' do
|
111
|
+
expect(de_vat.vat_country_code).to eql('DE')
|
112
|
+
expect(at_vat.vat_country_code).to eql('AT')
|
124
113
|
end
|
125
114
|
|
126
|
-
it
|
127
|
-
expect(gr_vat.vat_country_code).to eql(
|
115
|
+
it 'returns EL iso language code on greek VAT number' do
|
116
|
+
expect(gr_vat.vat_country_code).to eql('EL')
|
128
117
|
end
|
129
118
|
end
|
130
119
|
|
131
|
-
describe
|
132
|
-
it
|
120
|
+
describe '#european?' do
|
121
|
+
it 'returns true' do
|
133
122
|
expect(de_vat).to be_european
|
134
123
|
expect(at_vat).to be_european
|
135
124
|
expect(gr_vat).to be_european
|
136
125
|
end
|
137
126
|
end
|
138
127
|
|
139
|
-
describe
|
140
|
-
it
|
141
|
-
expect(de_vat.to_s).to eql(
|
142
|
-
expect(at_vat.to_s).to eql(
|
143
|
-
expect(gr_vat.to_s).to eql(
|
128
|
+
describe '#to_s' do
|
129
|
+
it 'returns full VAT number' do
|
130
|
+
expect(de_vat.to_s).to eql('DE259597697')
|
131
|
+
expect(at_vat.to_s).to eql('ATU458890031')
|
132
|
+
expect(gr_vat.to_s).to eql('EL999943280')
|
144
133
|
end
|
145
134
|
end
|
146
135
|
|
147
|
-
describe
|
148
|
-
it
|
149
|
-
expect(de_vat.inspect).to eql(
|
150
|
-
expect(at_vat.inspect).to eql(
|
151
|
-
expect(gr_vat.inspect).to eql(
|
136
|
+
describe '#inspect' do
|
137
|
+
it 'returns VAT number with iso country code' do
|
138
|
+
expect(de_vat.inspect).to eql('#<Valvat DE259597697 DE>')
|
139
|
+
expect(at_vat.inspect).to eql('#<Valvat ATU458890031 AT>')
|
140
|
+
expect(gr_vat.inspect).to eql('#<Valvat EL999943280 GR>')
|
152
141
|
end
|
153
142
|
end
|
154
143
|
|
155
|
-
describe
|
156
|
-
it
|
144
|
+
describe '#to_a' do
|
145
|
+
it 'calls Valvat::Utils.split with raw VAT number and returns result' do
|
146
|
+
allow(Valvat::Utils).to receive(:split).and_return(%w[a b])
|
157
147
|
de_vat # initialize
|
158
|
-
expect(Valvat::Utils).to
|
159
|
-
expect(de_vat.to_a).to eql([
|
148
|
+
expect(Valvat::Utils).to have_received(:split).once.with('DE259597697')
|
149
|
+
expect(de_vat.to_a).to eql(%w[a b])
|
160
150
|
end
|
161
151
|
end
|
162
152
|
end
|
163
153
|
|
164
|
-
context
|
165
|
-
let(:us_vat) {
|
166
|
-
let(:ch_vat) {
|
154
|
+
context 'with VAT number from outside of europe' do
|
155
|
+
let(:us_vat) { described_class.new('US345889003') }
|
156
|
+
let(:ch_vat) { described_class.new('CH445889003') }
|
167
157
|
|
168
|
-
describe
|
169
|
-
it
|
158
|
+
describe '#valid?' do
|
159
|
+
it 'returns false' do
|
170
160
|
expect(us_vat).not_to be_valid
|
171
161
|
expect(ch_vat).not_to be_valid
|
172
162
|
end
|
173
163
|
end
|
174
164
|
|
175
|
-
describe
|
176
|
-
it
|
165
|
+
describe '#exist?' do
|
166
|
+
it 'returns false' do
|
177
167
|
expect(us_vat).not_to be_exist
|
178
168
|
expect(ch_vat).not_to be_exist
|
179
169
|
end
|
180
170
|
end
|
181
171
|
|
182
|
-
describe
|
183
|
-
it
|
184
|
-
expect(us_vat.iso_country_code).to
|
185
|
-
expect(ch_vat.iso_country_code).to
|
172
|
+
describe '#iso_country_code' do
|
173
|
+
it 'returns nil' do
|
174
|
+
expect(us_vat.iso_country_code).to be(nil)
|
175
|
+
expect(ch_vat.iso_country_code).to be(nil)
|
186
176
|
end
|
187
177
|
end
|
188
178
|
|
189
|
-
describe
|
190
|
-
it
|
191
|
-
expect(us_vat.vat_country_code).to
|
192
|
-
expect(ch_vat.vat_country_code).to
|
179
|
+
describe '#vat_country_code' do
|
180
|
+
it 'returns nil' do
|
181
|
+
expect(us_vat.vat_country_code).to be(nil)
|
182
|
+
expect(ch_vat.vat_country_code).to be(nil)
|
193
183
|
end
|
194
184
|
end
|
195
185
|
|
196
|
-
describe
|
197
|
-
it
|
186
|
+
describe '#european?' do
|
187
|
+
it 'returns false' do
|
198
188
|
expect(us_vat).not_to be_european
|
199
189
|
expect(ch_vat).not_to be_european
|
200
190
|
end
|
201
191
|
end
|
202
192
|
|
203
|
-
describe
|
204
|
-
it
|
205
|
-
expect(us_vat.to_s).to eql(
|
206
|
-
expect(ch_vat.to_s).to eql(
|
193
|
+
describe '#to_s' do
|
194
|
+
it 'returns full given VAT number' do
|
195
|
+
expect(us_vat.to_s).to eql('US345889003')
|
196
|
+
expect(ch_vat.to_s).to eql('CH445889003')
|
207
197
|
end
|
208
198
|
end
|
209
199
|
|
210
|
-
describe
|
211
|
-
it
|
212
|
-
expect(us_vat.inspect).to eql(
|
213
|
-
expect(ch_vat.inspect).to eql(
|
200
|
+
describe '#inspect' do
|
201
|
+
it 'returns VAT number without iso country code' do
|
202
|
+
expect(us_vat.inspect).to eql('#<Valvat US345889003>')
|
203
|
+
expect(ch_vat.inspect).to eql('#<Valvat CH445889003>')
|
214
204
|
end
|
215
205
|
end
|
216
|
-
|
217
206
|
end
|
218
207
|
|
219
|
-
context
|
220
|
-
let(:only_iso_vat) {
|
221
|
-
let(:num_vat) {
|
222
|
-
let(:empty_vat) {
|
223
|
-
let(:nil_vat) {
|
208
|
+
context 'with non-sense/empty VAT number' do
|
209
|
+
let(:only_iso_vat) { described_class.new('DE') }
|
210
|
+
let(:num_vat) { described_class.new('12445889003') }
|
211
|
+
let(:empty_vat) { described_class.new('') }
|
212
|
+
let(:nil_vat) { described_class.new('') }
|
224
213
|
|
225
|
-
describe
|
226
|
-
it
|
214
|
+
describe '#valid?' do
|
215
|
+
it 'returns false' do
|
227
216
|
expect(only_iso_vat).not_to be_valid
|
228
217
|
expect(num_vat).not_to be_valid
|
229
218
|
expect(empty_vat).not_to be_valid
|
@@ -231,8 +220,8 @@ describe Valvat do
|
|
231
220
|
end
|
232
221
|
end
|
233
222
|
|
234
|
-
describe
|
235
|
-
it
|
223
|
+
describe '#exist?' do
|
224
|
+
it 'returns false' do
|
236
225
|
expect(only_iso_vat).not_to be_exist
|
237
226
|
expect(num_vat).not_to be_exist
|
238
227
|
expect(empty_vat).not_to be_exist
|
@@ -240,26 +229,26 @@ describe Valvat do
|
|
240
229
|
end
|
241
230
|
end
|
242
231
|
|
243
|
-
describe
|
244
|
-
it
|
245
|
-
expect(only_iso_vat.iso_country_code).to
|
246
|
-
expect(num_vat.iso_country_code).to
|
247
|
-
expect(empty_vat.iso_country_code).to
|
248
|
-
expect(nil_vat.iso_country_code).to
|
232
|
+
describe '#iso_country_code' do
|
233
|
+
it 'returns nil' do
|
234
|
+
expect(only_iso_vat.iso_country_code).to be(nil)
|
235
|
+
expect(num_vat.iso_country_code).to be(nil)
|
236
|
+
expect(empty_vat.iso_country_code).to be(nil)
|
237
|
+
expect(nil_vat.iso_country_code).to be(nil)
|
249
238
|
end
|
250
239
|
end
|
251
240
|
|
252
|
-
describe
|
253
|
-
it
|
254
|
-
expect(only_iso_vat.vat_country_code).to
|
255
|
-
expect(num_vat.vat_country_code).to
|
256
|
-
expect(empty_vat.vat_country_code).to
|
257
|
-
expect(nil_vat.vat_country_code).to
|
241
|
+
describe '#vat_country_code' do
|
242
|
+
it 'returns nil' do
|
243
|
+
expect(only_iso_vat.vat_country_code).to be(nil)
|
244
|
+
expect(num_vat.vat_country_code).to be(nil)
|
245
|
+
expect(empty_vat.vat_country_code).to be(nil)
|
246
|
+
expect(nil_vat.vat_country_code).to be(nil)
|
258
247
|
end
|
259
248
|
end
|
260
249
|
|
261
|
-
describe
|
262
|
-
it
|
250
|
+
describe '#european?' do
|
251
|
+
it 'returns false' do
|
263
252
|
expect(only_iso_vat).not_to be_european
|
264
253
|
expect(num_vat).not_to be_european
|
265
254
|
expect(empty_vat).not_to be_european
|
@@ -267,23 +256,22 @@ describe Valvat do
|
|
267
256
|
end
|
268
257
|
end
|
269
258
|
|
270
|
-
describe
|
271
|
-
it
|
272
|
-
expect(only_iso_vat.to_s).to eql(
|
273
|
-
expect(num_vat.to_s).to eql(
|
274
|
-
expect(empty_vat.to_s).to eql(
|
275
|
-
expect(nil_vat.to_s).to eql(
|
259
|
+
describe '#to_s' do
|
260
|
+
it 'returns full given VAT number' do
|
261
|
+
expect(only_iso_vat.to_s).to eql('DE')
|
262
|
+
expect(num_vat.to_s).to eql('12445889003')
|
263
|
+
expect(empty_vat.to_s).to eql('')
|
264
|
+
expect(nil_vat.to_s).to eql('')
|
276
265
|
end
|
277
266
|
end
|
278
267
|
|
279
|
-
describe
|
280
|
-
it
|
281
|
-
expect(only_iso_vat.inspect).to eql(
|
282
|
-
expect(num_vat.inspect).to eql(
|
283
|
-
expect(empty_vat.inspect).to eql(
|
284
|
-
expect(nil_vat.inspect).to eql(
|
268
|
+
describe '#inspect' do
|
269
|
+
it 'returns VAT number without iso country code' do
|
270
|
+
expect(only_iso_vat.inspect).to eql('#<Valvat DE>')
|
271
|
+
expect(num_vat.inspect).to eql('#<Valvat 12445889003>')
|
272
|
+
expect(empty_vat.inspect).to eql('#<Valvat >')
|
273
|
+
expect(nil_vat.inspect).to eql('#<Valvat >')
|
285
274
|
end
|
286
275
|
end
|
287
|
-
|
288
276
|
end
|
289
|
-
end
|
277
|
+
end
|
data/valvat.gemspec
CHANGED
@@ -1,28 +1,28 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
4
|
+
require 'valvat/version'
|
4
5
|
|
5
6
|
Gem::Specification.new do |s|
|
6
|
-
s.name =
|
7
|
+
s.name = 'valvat'
|
7
8
|
s.version = Valvat::VERSION
|
8
9
|
s.platform = Gem::Platform::RUBY
|
9
10
|
s.license = 'MIT'
|
10
|
-
s.authors = [
|
11
|
-
s.email = [
|
12
|
-
s.homepage =
|
13
|
-
s.summary =
|
14
|
-
s.description =
|
11
|
+
s.authors = ['Sebastian Munz']
|
12
|
+
s.email = ['sebastian@yo.lk']
|
13
|
+
s.homepage = 'https://github.com/yolk/valvat'
|
14
|
+
s.summary = 'Validates european vat numbers. Standalone or as a ActiveModel validator.'
|
15
|
+
s.description = 'Validates european vat numbers. Standalone or as a ActiveModel validator.'
|
15
16
|
s.files = `git ls-files`.split("\n")
|
16
|
-
s.test_files = `git ls-files --
|
17
|
-
s.
|
18
|
-
s.require_paths = ["lib"]
|
17
|
+
s.test_files = `git ls-files -- spec/*`.split("\n")
|
18
|
+
s.require_paths = ['lib']
|
19
19
|
s.cert_chain = ['certs/yolk.pem']
|
20
|
-
s.signing_key = File.expand_path(
|
21
|
-
s.required_ruby_version = '>=
|
20
|
+
s.signing_key = File.expand_path('~/.ssh/gem-private_key.pem') if $PROGRAM_NAME =~ /gem\z/
|
21
|
+
s.required_ruby_version = '>= 2.5.0'
|
22
22
|
|
23
|
-
s.add_dependency 'savon',
|
23
|
+
s.add_dependency 'savon', '>= 2.3.0'
|
24
24
|
|
25
|
+
s.add_development_dependency 'activemodel', '>= 5.0'
|
25
26
|
s.add_development_dependency 'rake'
|
26
|
-
s.add_development_dependency 'rspec',
|
27
|
-
s.add_development_dependency 'activemodel', '>= 3.0'
|
27
|
+
s.add_development_dependency 'rspec', '~> 3.0'
|
28
28
|
end
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
k��;���{�P��m_�n���-���'��5^�B��������|
��=
|
1
|
+
X�R��oy����+�����k�d���/�P�je�?�C�5�����S���cQ�fۆ���=4f�À�nQ��Y�t8�u�f瑘 �}
|