valvat 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/.github/workflows/ruby.yml +35 -0
  5. data/.gitignore +1 -0
  6. data/.rubocop.yml +15 -0
  7. data/CHANGES.md +9 -1
  8. data/Gemfile +2 -0
  9. data/Guardfile +6 -4
  10. data/README.md +5 -3
  11. data/Rakefile +3 -1
  12. data/gemfiles/activemodel-5 +1 -1
  13. data/gemfiles/activemodel-6 +1 -1
  14. data/lib/active_model/validations/valvat_validator.rb +65 -32
  15. data/lib/valvat.rb +4 -2
  16. data/lib/valvat/checksum.rb +14 -13
  17. data/lib/valvat/checksum/at.rb +3 -1
  18. data/lib/valvat/checksum/be.rb +3 -1
  19. data/lib/valvat/checksum/bg.rb +17 -17
  20. data/lib/valvat/checksum/cy.rb +2 -0
  21. data/lib/valvat/checksum/de.rb +5 -3
  22. data/lib/valvat/checksum/dk.rb +3 -1
  23. data/lib/valvat/checksum/ee.rb +2 -0
  24. data/lib/valvat/checksum/es.rb +14 -16
  25. data/lib/valvat/checksum/fi.rb +3 -1
  26. data/lib/valvat/checksum/fr.rb +4 -2
  27. data/lib/valvat/checksum/gb.rb +46 -31
  28. data/lib/valvat/checksum/gr.rb +4 -2
  29. data/lib/valvat/checksum/hr.rb +2 -0
  30. data/lib/valvat/checksum/hu.rb +2 -0
  31. data/lib/valvat/checksum/ie.rb +5 -6
  32. data/lib/valvat/checksum/it.rb +6 -4
  33. data/lib/valvat/checksum/lt.rb +2 -0
  34. data/lib/valvat/checksum/lu.rb +3 -1
  35. data/lib/valvat/checksum/mt.rb +2 -0
  36. data/lib/valvat/checksum/nl.rb +5 -3
  37. data/lib/valvat/checksum/pl.rb +3 -1
  38. data/lib/valvat/checksum/pt.rb +3 -1
  39. data/lib/valvat/checksum/ro.rb +2 -0
  40. data/lib/valvat/checksum/se.rb +5 -3
  41. data/lib/valvat/checksum/si.rb +4 -2
  42. data/lib/valvat/error.rb +4 -1
  43. data/lib/valvat/local.rb +6 -4
  44. data/lib/valvat/locales/de.yml +2 -1
  45. data/lib/valvat/locales/en.yml +2 -1
  46. data/lib/valvat/locales/es.yml +1 -0
  47. data/lib/valvat/locales/fr.yml +1 -0
  48. data/lib/valvat/locales/hu.yml +1 -0
  49. data/lib/valvat/locales/nl.yml +1 -0
  50. data/lib/valvat/locales/pl.yml +1 -0
  51. data/lib/valvat/lookup.rb +5 -4
  52. data/lib/valvat/lookup/fault.rb +17 -16
  53. data/lib/valvat/lookup/request.rb +21 -16
  54. data/lib/valvat/lookup/response.rb +11 -10
  55. data/lib/valvat/syntax.rb +31 -30
  56. data/lib/valvat/utils.rb +12 -9
  57. data/lib/valvat/version.rb +3 -1
  58. data/spec/active_model/validations/valvat_validator_spec.rb +99 -93
  59. data/spec/spec_helper.rb +8 -8
  60. data/spec/valvat/checksum/at_spec.rb +6 -4
  61. data/spec/valvat/checksum/be_spec.rb +6 -4
  62. data/spec/valvat/checksum/bg_spec.rb +7 -4
  63. data/spec/valvat/checksum/cy_spec.rb +3 -1
  64. data/spec/valvat/checksum/de_spec.rb +6 -4
  65. data/spec/valvat/checksum/dk_spec.rb +6 -4
  66. data/spec/valvat/checksum/ee_spec.rb +3 -1
  67. data/spec/valvat/checksum/es_spec.rb +7 -4
  68. data/spec/valvat/checksum/fi_spec.rb +6 -4
  69. data/spec/valvat/checksum/fr_spec.rb +6 -4
  70. data/spec/valvat/checksum/gb_spec.rb +4 -2
  71. data/spec/valvat/checksum/gr_spec.rb +6 -4
  72. data/spec/valvat/checksum/hr_spec.rb +3 -1
  73. data/spec/valvat/checksum/hu_spec.rb +3 -1
  74. data/spec/valvat/checksum/ie_spec.rb +8 -6
  75. data/spec/valvat/checksum/it_spec.rb +10 -8
  76. data/spec/valvat/checksum/lt_spec.rb +3 -1
  77. data/spec/valvat/checksum/lu_spec.rb +6 -4
  78. data/spec/valvat/checksum/mt_spec.rb +3 -1
  79. data/spec/valvat/checksum/nl_spec.rb +9 -7
  80. data/spec/valvat/checksum/pl_spec.rb +8 -6
  81. data/spec/valvat/checksum/pt_spec.rb +10 -11
  82. data/spec/valvat/checksum/ro_spec.rb +3 -1
  83. data/spec/valvat/checksum/se_spec.rb +8 -6
  84. data/spec/valvat/checksum/si_spec.rb +10 -8
  85. data/spec/valvat/checksum_spec.rb +11 -9
  86. data/spec/valvat/lookup/fault_spec.rb +34 -0
  87. data/spec/valvat/lookup/request_spec.rb +19 -0
  88. data/spec/valvat/lookup/response_spec.rb +29 -0
  89. data/spec/valvat/lookup_spec.rb +138 -153
  90. data/spec/valvat/syntax_spec.rb +59 -280
  91. data/spec/valvat/utils_spec.rb +62 -47
  92. data/spec/valvat_spec.rb +140 -152
  93. data/valvat.gemspec +17 -17
  94. metadata +24 -27
  95. metadata.gz.sig +0 -0
  96. data/.travis.yml +0 -47
  97. data/gemfiles/activemodel-3-2 +0 -7
  98. data/gemfiles/activemodel-4 +0 -7
  99. data/gemfiles/before-ruby21/activemodel-3-2 +0 -8
  100. data/gemfiles/before-ruby21/activemodel-4 +0 -8
  101. data/gemfiles/before-ruby21/standalone +0 -7
  102. data/spec/valvat/lockup/fault_spec.rb +0 -32
  103. data/spec/valvat/lockup/request_spec.rb +0 -15
  104. data/spec/valvat/lockup/response_spec.rb +0 -27
@@ -1,229 +1,218 @@
1
- require 'spec_helper'
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'spec_helper'
4
4
 
5
5
  describe Valvat do
6
- describe "#new" do
7
- it "demands one and only one argument" do
8
- expect{ Valvat.new }.to raise_error(ArgumentError)
9
- expect{ Valvat.new("a", "b") }.to raise_error(ArgumentError)
10
- expect{ Valvat.new("a") }.not_to raise_error
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 "normalizes input string" do
14
- expect(Valvat.new("de25.9597,69 7").to_s).to eql("DE259597697")
15
- expect(Valvat.new("de25.9597,69 7").iso_country_code).to eql("DE")
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
- context "Valvat()" do
20
- it "initializes new Valvat instance on string" do
21
- expect(Valvat("abc")).to be_kind_of(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 "returns same Valvat instance on Valvat instance" do
25
- vat = Valvat.new("abc")
26
- expect(Valvat(vat)).to be_kind_of(Valvat)
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
- describe "#blank?" do
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 "returns true when when initialized with an empty string" do
39
- expect(Valvat.new(" ")).to be_blank
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 "returns false when initialized with a value" do
43
- expect(Valvat.new("DE259597697")).not_to be_blank
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 "on european VAT number" do
48
- let(:de_vat) { Valvat.new("DE259597697") } # valid & exists
49
- let(:invalid_checksum) { Valvat.new("DE259597687") } # valid & invalid checksum
50
- let(:at_vat) { Valvat.new("ATU458890031") } # invalid
51
- let(:gr_vat) { Valvat.new("EL999943280") } # valid & exists
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 "#valid?" do
54
- it "returns true on valid numbers" do
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 "returns false on invalid numbers" do
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 "#valid_checksum?" do
65
- it "returns true on valid numbers" do
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 "returns false on invalid numbers" do
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 "#exist(s)?" do
77
- context "on existing VAT numbers" do
78
- before do
79
- allow(Valvat::Lookup).to receive_messages(validate: true)
80
- end
81
-
82
- it "returns true" do
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
- context "on not existing VAT numbers" do
91
- before do
92
- allow(Valvat::Lookup).to receive_messages(validate: false)
93
- end
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
- context "with options" do
102
- it "calls Valvat::Lookup.validate with options" do
103
- expect(Valvat::Lookup).to receive(:validate).once.with(de_vat, detail: true, bla: 'blupp').and_return(true)
104
- expect(de_vat.exists?(detail: true, bla: 'blupp')).to eql(true)
105
- end
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 "#iso_country_code" do
110
- it "returns iso country code on iso_country_code" do
111
- expect(de_vat.iso_country_code).to eql("DE")
112
- expect(at_vat.iso_country_code).to eql("AT")
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 "returns GR iso country code on greek VAT number" do
116
- expect(gr_vat.iso_country_code).to eql("GR")
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 "#vat_country_code" do
121
- it "returns iso country code on iso_country_code" do
122
- expect(de_vat.vat_country_code).to eql("DE")
123
- expect(at_vat.vat_country_code).to eql("AT")
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 "returns EL iso language code on greek VAT number" do
127
- expect(gr_vat.vat_country_code).to eql("EL")
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 "#european?" do
132
- it "returns true" do
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 "#to_s" do
140
- it "returns full VAT number" do
141
- expect(de_vat.to_s).to eql("DE259597697")
142
- expect(at_vat.to_s).to eql("ATU458890031")
143
- expect(gr_vat.to_s).to eql("EL999943280")
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 "#inspect" do
148
- it "returns VAT number with iso country code" do
149
- expect(de_vat.inspect).to eql("#<Valvat DE259597697 DE>")
150
- expect(at_vat.inspect).to eql("#<Valvat ATU458890031 AT>")
151
- expect(gr_vat.inspect).to eql("#<Valvat EL999943280 GR>")
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 "#to_a" do
156
- it "calls Valvat::Utils.split with raw VAT number and returns result" do
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 receive(:split).once.with("DE259597697").and_return(["a", "b"])
159
- expect(de_vat.to_a).to eql(["a", "b"])
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 "on VAT number from outside of europe" do
165
- let(:us_vat) { Valvat.new("US345889003") }
166
- let(:ch_vat) { Valvat.new("CH445889003") }
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 "#valid?" do
169
- it "returns false" do
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 "#exist?" do
176
- it "returns false" do
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 "#iso_country_code" do
183
- it "returns nil" do
184
- expect(us_vat.iso_country_code).to eql(nil)
185
- expect(ch_vat.iso_country_code).to eql(nil)
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 "#vat_country_code" do
190
- it "returns nil" do
191
- expect(us_vat.vat_country_code).to eql(nil)
192
- expect(ch_vat.vat_country_code).to eql(nil)
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 "#european?" do
197
- it "returns false" do
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 "#to_s" do
204
- it "returns full given VAT number" do
205
- expect(us_vat.to_s).to eql("US345889003")
206
- expect(ch_vat.to_s).to eql("CH445889003")
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 "#inspect" do
211
- it "returns VAT number without iso country code" do
212
- expect(us_vat.inspect).to eql("#<Valvat US345889003>")
213
- expect(ch_vat.inspect).to eql("#<Valvat CH445889003>")
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 "on non-sense/empty VAT number" do
220
- let(:only_iso_vat) { Valvat.new("DE") }
221
- let(:num_vat) { Valvat.new("12445889003") }
222
- let(:empty_vat) { Valvat.new("") }
223
- let(:nil_vat) { Valvat.new("") }
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 "#valid?" do
226
- it "returns false" do
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 "#exist?" do
235
- it "returns false" do
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 "#iso_country_code" do
244
- it "returns nil" do
245
- expect(only_iso_vat.iso_country_code).to eql(nil)
246
- expect(num_vat.iso_country_code).to eql(nil)
247
- expect(empty_vat.iso_country_code).to eql(nil)
248
- expect(nil_vat.iso_country_code).to eql(nil)
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 "#vat_country_code" do
253
- it "returns nil" do
254
- expect(only_iso_vat.vat_country_code).to eql(nil)
255
- expect(num_vat.vat_country_code).to eql(nil)
256
- expect(empty_vat.vat_country_code).to eql(nil)
257
- expect(nil_vat.vat_country_code).to eql(nil)
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 "#european?" do
262
- it "returns false" do
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 "#to_s" do
271
- it "returns full given VAT number" do
272
- expect(only_iso_vat.to_s).to eql("DE")
273
- expect(num_vat.to_s).to eql("12445889003")
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 "#inspect" do
280
- it "returns VAT number without iso country code" do
281
- expect(only_iso_vat.inspect).to eql("#<Valvat DE>")
282
- expect(num_vat.inspect).to eql("#<Valvat 12445889003>")
283
- expect(empty_vat.inspect).to eql("#<Valvat >")
284
- expect(nil_vat.inspect).to eql("#<Valvat >")
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
@@ -1,28 +1,28 @@
1
- # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "valvat/version"
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 = "valvat"
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 = ["Sebastian Munz"]
11
- s.email = ["sebastian@yo.lk"]
12
- s.homepage = "https://github.com/yolk/valvat"
13
- s.summary = %q{Validates european vat numbers. Standalone or as a ActiveModel validator.}
14
- s.description = %q{Validates european vat numbers. Standalone or as a ActiveModel validator.}
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 -- {test,spec,features}/*`.split("\n")
17
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
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("~/.ssh/gem-private_key.pem") if $0 =~ /gem\z/
21
- s.required_ruby_version = '>= 1.9.3'
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', '>= 2.3.0'
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', '~> 3.0'
27
- s.add_development_dependency 'activemodel', '>= 3.0'
27
+ s.add_development_dependency 'rspec', '~> 3.0'
28
28
  end