valvat 0.4.5 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES.md CHANGED
@@ -1,6 +1,12 @@
1
1
  ### dev
2
2
 
3
- [full changelog](http://github.com/yolk/valvat/compare/v0.4.5...master)
3
+ [full changelog](http://github.com/yolk/valvat/compare/v0.4.6...master)
4
+
5
+ ### 0.4.6 / 2013-07-01
6
+
7
+ [full changelog](http://github.com/yolk/valvat/compare/v0.4.5...v0.4.6)
8
+
9
+ * Added support for croatian vat numbers (by [mowli](https://github.com/mowli))
4
10
 
5
11
  ### 0.4.5 / 2013-02-16
6
12
 
data/lib/valvat/syntax.rb CHANGED
@@ -17,6 +17,7 @@ class Valvat
17
17
  'FI' => /\AFI[0-9]{8}\Z/, # Finland
18
18
  'FR' => /\AFR[A-Z0-9]{2}[0-9]{9}\Z/, # France
19
19
  'GB' => /\AGB([0-9]{9}|[0-9]{12}|(HA|GD)[0-9]{3})\Z/, # United Kingdom
20
+ 'HR' => /\AHR[0-9]{11}\Z/, # Croatia
20
21
  'HU' => /\AHU[0-9]{8}\Z/, # Hungary
21
22
  'IE' => /\AIE([0-9][A-Z][0-9]{5}|[0-9]{7})[A-Z]\Z/, # Ireland
22
23
  'IT' => /\AIT[0-9]{11}\Z/, # Italy
data/lib/valvat/utils.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  class Valvat
2
2
  module Utils
3
3
 
4
- EU_COUNTRIES = %w(AT BE BG CY CZ DE DK EE ES FI FR GB GR HU IE IT LT LU LV MT NL PL PT RO SE SI SK)
4
+ EU_COUNTRIES = %w(AT BE BG CY CZ DE DK EE ES FI FR GB GR HR HU IE IT LT LU LV MT NL PL PT RO SE SI SK)
5
5
  COUNTRY_PATTERN = /\A([A-Z]{2})(.+)\Z/
6
6
  NORMALIZE_PATTERN = /[-\.:_\s,;]+/
7
7
 
@@ -1,3 +1,3 @@
1
1
  class Valvat
2
- VERSION = "0.4.5"
2
+ VERSION = "0.4.6"
3
3
  end
@@ -3,274 +3,282 @@ require 'spec_helper'
3
3
  describe Valvat::Syntax do
4
4
  describe "#validate" do
5
5
  it "validates a DE vat number" do
6
- Valvat::Syntax.validate("DE345889003").should eql(true)
6
+ subject.validate("DE345889003").should eql(true)
7
7
 
8
- Valvat::Syntax.validate("DE34588900").should eql(false)
9
- Valvat::Syntax.validate("DE3458890090").should eql(false)
10
- Valvat::Syntax.validate("DE34588900C").should eql(false)
8
+ subject.validate("DE34588900").should eql(false)
9
+ subject.validate("DE3458890090").should eql(false)
10
+ subject.validate("DE34588900C").should eql(false)
11
11
  end
12
12
 
13
13
  it "validates a AT vat number" do
14
- Valvat::Syntax.validate("ATU03458890").should eql(true)
14
+ subject.validate("ATU03458890").should eql(true)
15
15
 
16
- Valvat::Syntax.validate("ATU034588908").should eql(false)
17
- Valvat::Syntax.validate("ATU0345908").should eql(false)
18
- Valvat::Syntax.validate("ATU0345889Y").should eql(false)
16
+ subject.validate("ATU034588908").should eql(false)
17
+ subject.validate("ATU0345908").should eql(false)
18
+ subject.validate("ATU0345889Y").should eql(false)
19
19
  end
20
20
 
21
21
  it "should validate BE vat number" do
22
- Valvat::Syntax.validate("BE0817331995").should eql(true)
22
+ subject.validate("BE0817331995").should eql(true)
23
23
 
24
- Valvat::Syntax.validate("BE081733199").should eql(false)
25
- Valvat::Syntax.validate("BE08173319944").should eql(false)
26
- Valvat::Syntax.validate("BE081733199H").should eql(false)
27
- Valvat::Syntax.validate("BE1817331999").should eql(false)
24
+ subject.validate("BE081733199").should eql(false)
25
+ subject.validate("BE08173319944").should eql(false)
26
+ subject.validate("BE081733199H").should eql(false)
27
+ subject.validate("BE1817331999").should eql(false)
28
28
  end
29
29
 
30
30
  it "validates a BG vat number" do
31
- Valvat::Syntax.validate("BG468134789").should eql(true)
32
- Valvat::Syntax.validate("BG4681347897").should eql(true)
31
+ subject.validate("BG468134789").should eql(true)
32
+ subject.validate("BG4681347897").should eql(true)
33
33
 
34
- Valvat::Syntax.validate("BG46813478979").should eql(false)
35
- Valvat::Syntax.validate("BG4681347897C").should eql(false)
36
- Valvat::Syntax.validate("BG46813478G").should eql(false)
37
- Valvat::Syntax.validate("BG46813478").should eql(false)
34
+ subject.validate("BG46813478979").should eql(false)
35
+ subject.validate("BG4681347897C").should eql(false)
36
+ subject.validate("BG46813478G").should eql(false)
37
+ subject.validate("BG46813478").should eql(false)
38
38
  end
39
39
 
40
40
  it "validates a CY vat number" do
41
- Valvat::Syntax.validate("CY36579347A").should eql(true)
42
- Valvat::Syntax.validate("CY36579347C").should eql(true)
41
+ subject.validate("CY36579347A").should eql(true)
42
+ subject.validate("CY36579347C").should eql(true)
43
43
 
44
- Valvat::Syntax.validate("CY36579347").should eql(false)
45
- Valvat::Syntax.validate("CY365793478").should eql(false)
46
- Valvat::Syntax.validate("CY365793478A").should eql(false)
47
- Valvat::Syntax.validate("CY365793G").should eql(false)
44
+ subject.validate("CY36579347").should eql(false)
45
+ subject.validate("CY365793478").should eql(false)
46
+ subject.validate("CY365793478A").should eql(false)
47
+ subject.validate("CY365793G").should eql(false)
48
48
  end
49
49
 
50
50
  it "validates a DK vat number" do
51
- Valvat::Syntax.validate("DK67893463").should eql(true)
51
+ subject.validate("DK67893463").should eql(true)
52
52
 
53
- Valvat::Syntax.validate("DK678934637").should eql(false)
54
- Valvat::Syntax.validate("DK6789346").should eql(false)
55
- Valvat::Syntax.validate("DK6789346H").should eql(false)
53
+ subject.validate("DK678934637").should eql(false)
54
+ subject.validate("DK6789346").should eql(false)
55
+ subject.validate("DK6789346H").should eql(false)
56
56
  end
57
57
 
58
58
  it "validates a ES vat number" do
59
- Valvat::Syntax.validate("ESX67345987").should eql(true)
60
- Valvat::Syntax.validate("ESA6734598B").should eql(true)
61
- Valvat::Syntax.validate("ES56734598C").should eql(true)
59
+ subject.validate("ESX67345987").should eql(true)
60
+ subject.validate("ESA6734598B").should eql(true)
61
+ subject.validate("ES56734598C").should eql(true)
62
62
 
63
- Valvat::Syntax.validate("ES167345987").should eql(false)
64
- Valvat::Syntax.validate("ESX6734598").should eql(false)
65
- Valvat::Syntax.validate("ESX673459890").should eql(false)
63
+ subject.validate("ES167345987").should eql(false)
64
+ subject.validate("ESX6734598").should eql(false)
65
+ subject.validate("ESX673459890").should eql(false)
66
66
  end
67
67
 
68
68
  it "validates a EE vat number" do
69
- Valvat::Syntax.validate("EE678678456").should eql(true)
70
- Valvat::Syntax.validate("EE6786784560").should eql(false)
71
- Valvat::Syntax.validate("EE67867845").should eql(false)
72
- Valvat::Syntax.validate("EE67867845K").should eql(false)
69
+ subject.validate("EE678678456").should eql(true)
70
+ subject.validate("EE6786784560").should eql(false)
71
+ subject.validate("EE67867845").should eql(false)
72
+ subject.validate("EE67867845K").should eql(false)
73
73
  end
74
74
 
75
75
  it "validates a FI vat number" do
76
- Valvat::Syntax.validate("FI67845638").should eql(true)
76
+ subject.validate("FI67845638").should eql(true)
77
77
 
78
- Valvat::Syntax.validate("FI678456389").should eql(false)
79
- Valvat::Syntax.validate("FI6784563").should eql(false)
80
- Valvat::Syntax.validate("FI6784563K").should eql(false)
78
+ subject.validate("FI678456389").should eql(false)
79
+ subject.validate("FI6784563").should eql(false)
80
+ subject.validate("FI6784563K").should eql(false)
81
81
  end
82
82
 
83
83
  it "validates a FR vat number" do
84
- Valvat::Syntax.validate("FR99123543267").should eql(true)
85
- Valvat::Syntax.validate("FRBB123543267").should eql(true)
86
- Valvat::Syntax.validate("FR9B123543267").should eql(true)
87
- Valvat::Syntax.validate("FRB9123543267").should eql(true)
88
-
89
- Valvat::Syntax.validate("FR99123543267B").should eql(false)
90
- Valvat::Syntax.validate("FRBB12354326").should eql(false)
91
- Valvat::Syntax.validate("FR9B123543F67").should eql(false)
92
- Valvat::Syntax.validate("FRB9123543").should eql(false)
84
+ subject.validate("FR99123543267").should eql(true)
85
+ subject.validate("FRBB123543267").should eql(true)
86
+ subject.validate("FR9B123543267").should eql(true)
87
+ subject.validate("FRB9123543267").should eql(true)
88
+
89
+ subject.validate("FR99123543267B").should eql(false)
90
+ subject.validate("FRBB12354326").should eql(false)
91
+ subject.validate("FR9B123543F67").should eql(false)
92
+ subject.validate("FRB9123543").should eql(false)
93
93
  end
94
94
 
95
95
  it "validates a EL vat number" do
96
- Valvat::Syntax.validate("EL678456345").should eql(true)
96
+ subject.validate("EL678456345").should eql(true)
97
97
 
98
- Valvat::Syntax.validate("EL67845634").should eql(false)
99
- Valvat::Syntax.validate("EL6784563459").should eql(false)
100
- Valvat::Syntax.validate("EL67845634P").should eql(false)
98
+ subject.validate("EL67845634").should eql(false)
99
+ subject.validate("EL6784563459").should eql(false)
100
+ subject.validate("EL67845634P").should eql(false)
101
101
  end
102
102
 
103
103
  it "validates a HU vat number" do
104
- Valvat::Syntax.validate("HU67894595").should eql(true)
104
+ subject.validate("HU67894595").should eql(true)
105
105
 
106
- Valvat::Syntax.validate("HU6789459").should eql(false)
107
- Valvat::Syntax.validate("HU67894595L").should eql(false)
108
- Valvat::Syntax.validate("HU6789459J").should eql(false)
106
+ subject.validate("HU6789459").should eql(false)
107
+ subject.validate("HU67894595L").should eql(false)
108
+ subject.validate("HU6789459J").should eql(false)
109
+ end
110
+
111
+ it "validates a HR vat number" do
112
+ subject.validate("HR12345678912").should eql(true)
113
+
114
+ subject.validate("HR6789459").should eql(false)
115
+ subject.validate("HR67894595L").should eql(false)
116
+ subject.validate("HR6789459J").should eql(false)
109
117
  end
110
118
 
111
119
  it "validates a IE vat number" do
112
- Valvat::Syntax.validate("IE1B12345J").should eql(true)
113
- Valvat::Syntax.validate("IE1234567B").should eql(true)
120
+ subject.validate("IE1B12345J").should eql(true)
121
+ subject.validate("IE1234567B").should eql(true)
114
122
 
115
- Valvat::Syntax.validate("IE1B123459").should eql(false)
116
- Valvat::Syntax.validate("IE19123450").should eql(false)
117
- Valvat::Syntax.validate("IEA9123450").should eql(false)
123
+ subject.validate("IE1B123459").should eql(false)
124
+ subject.validate("IE19123450").should eql(false)
125
+ subject.validate("IEA9123450").should eql(false)
118
126
  end
119
127
 
120
128
  it "validates a IT vat number" do
121
- Valvat::Syntax.validate("IT45875359285").should eql(true)
129
+ subject.validate("IT45875359285").should eql(true)
122
130
 
123
- Valvat::Syntax.validate("IT458753592859").should eql(false)
124
- Valvat::Syntax.validate("IT4587535928G").should eql(false)
125
- Valvat::Syntax.validate("IT4587535928").should eql(false)
131
+ subject.validate("IT458753592859").should eql(false)
132
+ subject.validate("IT4587535928G").should eql(false)
133
+ subject.validate("IT4587535928").should eql(false)
126
134
  end
127
135
 
128
136
  it "validates a LV vat number" do
129
- Valvat::Syntax.validate("LV85678368906").should eql(true)
137
+ subject.validate("LV85678368906").should eql(true)
130
138
 
131
- Valvat::Syntax.validate("LV8567836890").should eql(false)
132
- Valvat::Syntax.validate("LV856783689066").should eql(false)
133
- Valvat::Syntax.validate("LV8567836890S").should eql(false)
139
+ subject.validate("LV8567836890").should eql(false)
140
+ subject.validate("LV856783689066").should eql(false)
141
+ subject.validate("LV8567836890S").should eql(false)
134
142
  end
135
143
 
136
144
  it "validates a LT vat number" do
137
- Valvat::Syntax.validate("LT678678987").should eql(true)
138
- Valvat::Syntax.validate("LT678678987956").should eql(true)
139
-
140
- Valvat::Syntax.validate("LT67867898").should eql(false)
141
- Valvat::Syntax.validate("LT6786789870").should eql(false)
142
- Valvat::Syntax.validate("LT678678987K").should eql(false)
143
- Valvat::Syntax.validate("LT67867898709").should eql(false)
144
- Valvat::Syntax.validate("LT6786789870C").should eql(false)
145
- Valvat::Syntax.validate("LT67867898795H").should eql(false)
145
+ subject.validate("LT678678987").should eql(true)
146
+ subject.validate("LT678678987956").should eql(true)
147
+
148
+ subject.validate("LT67867898").should eql(false)
149
+ subject.validate("LT6786789870").should eql(false)
150
+ subject.validate("LT678678987K").should eql(false)
151
+ subject.validate("LT67867898709").should eql(false)
152
+ subject.validate("LT6786789870C").should eql(false)
153
+ subject.validate("LT67867898795H").should eql(false)
146
154
  end
147
155
 
148
156
  it "validates a LU vat number" do
149
- Valvat::Syntax.validate("LU45679456").should eql(true)
157
+ subject.validate("LU45679456").should eql(true)
150
158
 
151
- Valvat::Syntax.validate("LU4567945").should eql(false)
152
- Valvat::Syntax.validate("LU456794560").should eql(false)
153
- Valvat::Syntax.validate("LU4567945J").should eql(false)
159
+ subject.validate("LU4567945").should eql(false)
160
+ subject.validate("LU456794560").should eql(false)
161
+ subject.validate("LU4567945J").should eql(false)
154
162
  end
155
163
 
156
164
  it "validates a MT vat number" do
157
- Valvat::Syntax.validate("MT64569367").should eql(true)
165
+ subject.validate("MT64569367").should eql(true)
158
166
 
159
- Valvat::Syntax.validate("MT6456936").should eql(false)
160
- Valvat::Syntax.validate("MT645693679").should eql(false)
161
- Valvat::Syntax.validate("MT6456936L").should eql(false)
167
+ subject.validate("MT6456936").should eql(false)
168
+ subject.validate("MT645693679").should eql(false)
169
+ subject.validate("MT6456936L").should eql(false)
162
170
  end
163
171
 
164
172
  it "validates a NL vat number" do
165
- Valvat::Syntax.validate("NL673739491B77").should eql(true)
173
+ subject.validate("NL673739491B77").should eql(true)
166
174
 
167
- Valvat::Syntax.validate("NL673739491977").should eql(false)
168
- Valvat::Syntax.validate("NL673739491A77").should eql(false)
169
- Valvat::Syntax.validate("NL673739491B771").should eql(false)
170
- Valvat::Syntax.validate("NL673739491B7").should eql(false)
171
- Valvat::Syntax.validate("NL6737394917B7").should eql(false)
175
+ subject.validate("NL673739491977").should eql(false)
176
+ subject.validate("NL673739491A77").should eql(false)
177
+ subject.validate("NL673739491B771").should eql(false)
178
+ subject.validate("NL673739491B7").should eql(false)
179
+ subject.validate("NL6737394917B7").should eql(false)
172
180
  end
173
181
 
174
182
  it "validates a PL vat number" do
175
- Valvat::Syntax.validate("PL6784567284").should eql(true)
183
+ subject.validate("PL6784567284").should eql(true)
176
184
 
177
- Valvat::Syntax.validate("PL678456728").should eql(false)
178
- Valvat::Syntax.validate("PL67845672849").should eql(false)
179
- Valvat::Syntax.validate("PL678456728K").should eql(false)
185
+ subject.validate("PL678456728").should eql(false)
186
+ subject.validate("PL67845672849").should eql(false)
187
+ subject.validate("PL678456728K").should eql(false)
180
188
  end
181
189
 
182
190
  it "validates a PT vat number" do
183
- Valvat::Syntax.validate("PT346296476").should eql(true)
191
+ subject.validate("PT346296476").should eql(true)
184
192
 
185
- Valvat::Syntax.validate("PT34629647").should eql(false)
186
- Valvat::Syntax.validate("PT3462964769").should eql(false)
193
+ subject.validate("PT34629647").should eql(false)
194
+ subject.validate("PT3462964769").should eql(false)
187
195
  end
188
196
 
189
197
  it "validates a GB vat number" do
190
- Valvat::Syntax.validate("GB123456789").should eql(true)
191
- Valvat::Syntax.validate("GB123456789012").should eql(true)
192
- Valvat::Syntax.validate("GBGD123").should eql(true)
193
- Valvat::Syntax.validate("GBHA123").should eql(true)
194
-
195
- Valvat::Syntax.validate("GB12345678").should eql(false)
196
- Valvat::Syntax.validate("GB1234567890").should eql(false)
197
- Valvat::Syntax.validate("GB12345678901").should eql(false)
198
- Valvat::Syntax.validate("GB1234567890123").should eql(false)
199
- Valvat::Syntax.validate("GBAB123").should eql(false)
200
- Valvat::Syntax.validate("GBAA123").should eql(false)
201
- Valvat::Syntax.validate("GBHH123").should eql(false)
202
- Valvat::Syntax.validate("GBGD1234").should eql(false)
203
- Valvat::Syntax.validate("GBGD12").should eql(false)
198
+ subject.validate("GB123456789").should eql(true)
199
+ subject.validate("GB123456789012").should eql(true)
200
+ subject.validate("GBGD123").should eql(true)
201
+ subject.validate("GBHA123").should eql(true)
202
+
203
+ subject.validate("GB12345678").should eql(false)
204
+ subject.validate("GB1234567890").should eql(false)
205
+ subject.validate("GB12345678901").should eql(false)
206
+ subject.validate("GB1234567890123").should eql(false)
207
+ subject.validate("GBAB123").should eql(false)
208
+ subject.validate("GBAA123").should eql(false)
209
+ subject.validate("GBHH123").should eql(false)
210
+ subject.validate("GBGD1234").should eql(false)
211
+ subject.validate("GBGD12").should eql(false)
204
212
  end
205
213
 
206
214
  it "validates a RO vat number" do
207
- Valvat::Syntax.validate("RO1234567890").should eql(true)
208
- Valvat::Syntax.validate("RO123456789").should eql(true)
209
- Valvat::Syntax.validate("RO12345678").should eql(true)
210
- Valvat::Syntax.validate("RO1234567").should eql(true)
211
- Valvat::Syntax.validate("RO123456").should eql(true)
212
- Valvat::Syntax.validate("RO12345").should eql(true)
213
- Valvat::Syntax.validate("RO1234").should eql(true)
214
- Valvat::Syntax.validate("RO123").should eql(true)
215
- Valvat::Syntax.validate("RO12").should eql(true)
216
-
217
- Valvat::Syntax.validate("RO1").should eql(false)
218
- Valvat::Syntax.validate("RO0234567890").should eql(false)
219
- Valvat::Syntax.validate("RO023456789").should eql(false)
220
- Valvat::Syntax.validate("RO02345678").should eql(false)
221
- Valvat::Syntax.validate("RO0234567").should eql(false)
222
- Valvat::Syntax.validate("RO023456").should eql(false)
223
- Valvat::Syntax.validate("RO02345").should eql(false)
224
- Valvat::Syntax.validate("RO0234").should eql(false)
225
- Valvat::Syntax.validate("RO023").should eql(false)
226
- Valvat::Syntax.validate("RO02").should eql(false)
227
- Valvat::Syntax.validate("RO12345678901").should eql(false)
215
+ subject.validate("RO1234567890").should eql(true)
216
+ subject.validate("RO123456789").should eql(true)
217
+ subject.validate("RO12345678").should eql(true)
218
+ subject.validate("RO1234567").should eql(true)
219
+ subject.validate("RO123456").should eql(true)
220
+ subject.validate("RO12345").should eql(true)
221
+ subject.validate("RO1234").should eql(true)
222
+ subject.validate("RO123").should eql(true)
223
+ subject.validate("RO12").should eql(true)
224
+
225
+ subject.validate("RO1").should eql(false)
226
+ subject.validate("RO0234567890").should eql(false)
227
+ subject.validate("RO023456789").should eql(false)
228
+ subject.validate("RO02345678").should eql(false)
229
+ subject.validate("RO0234567").should eql(false)
230
+ subject.validate("RO023456").should eql(false)
231
+ subject.validate("RO02345").should eql(false)
232
+ subject.validate("RO0234").should eql(false)
233
+ subject.validate("RO023").should eql(false)
234
+ subject.validate("RO02").should eql(false)
235
+ subject.validate("RO12345678901").should eql(false)
228
236
  end
229
237
 
230
238
  it "validates a SK vat number" do
231
- Valvat::Syntax.validate("SK5683075682").should eql(true)
239
+ subject.validate("SK5683075682").should eql(true)
232
240
 
233
- Valvat::Syntax.validate("SK56830756821").should eql(false)
234
- Valvat::Syntax.validate("SK568307568").should eql(false)
241
+ subject.validate("SK56830756821").should eql(false)
242
+ subject.validate("SK568307568").should eql(false)
235
243
  end
236
244
 
237
245
  it "validates a SI vat number" do
238
- Valvat::Syntax.validate("SI74357893").should eql(true)
246
+ subject.validate("SI74357893").should eql(true)
239
247
 
240
- Valvat::Syntax.validate("SI743578931").should eql(false)
241
- Valvat::Syntax.validate("SI7435789").should eql(false)
248
+ subject.validate("SI743578931").should eql(false)
249
+ subject.validate("SI7435789").should eql(false)
242
250
  end
243
251
 
244
252
  it "validates a SE vat number" do
245
- Valvat::Syntax.validate("SE567396352701").should eql(true)
253
+ subject.validate("SE567396352701").should eql(true)
246
254
 
247
- Valvat::Syntax.validate("SE56739635201").should eql(false)
248
- Valvat::Syntax.validate("SE5673963527701").should eql(false)
249
- Valvat::Syntax.validate("SE567396352702").should eql(false)
250
- Valvat::Syntax.validate("SE567396352711").should eql(false)
255
+ subject.validate("SE56739635201").should eql(false)
256
+ subject.validate("SE5673963527701").should eql(false)
257
+ subject.validate("SE567396352702").should eql(false)
258
+ subject.validate("SE567396352711").should eql(false)
251
259
  end
252
260
 
253
261
  it "validates a CZ vat number" do
254
- Valvat::Syntax.validate("CZ56389267").should eql(true)
255
- Valvat::Syntax.validate("CZ563892670").should eql(true)
256
- Valvat::Syntax.validate("CZ5638926790").should eql(true)
262
+ subject.validate("CZ56389267").should eql(true)
263
+ subject.validate("CZ563892670").should eql(true)
264
+ subject.validate("CZ5638926790").should eql(true)
257
265
 
258
- Valvat::Syntax.validate("CZ5638926").should eql(false)
259
- Valvat::Syntax.validate("CZ56389268901").should eql(false)
266
+ subject.validate("CZ5638926").should eql(false)
267
+ subject.validate("CZ56389268901").should eql(false)
260
268
  end
261
269
 
262
270
  it "returns false on blank/non-sense vat number" do
263
- Valvat::Syntax.validate("").should eql(false)
264
- Valvat::Syntax.validate(" ").should eql(false)
265
- Valvat::Syntax.validate("DE").should eql(false)
266
- Valvat::Syntax.validate("atu123xyz").should eql(false)
267
- Valvat::Syntax.validate("xxxxxxxxxx").should eql(false)
268
- Valvat::Syntax.validate("BEFR").should eql(false)
271
+ subject.validate("").should eql(false)
272
+ subject.validate(" ").should eql(false)
273
+ subject.validate("DE").should eql(false)
274
+ subject.validate("atu123xyz").should eql(false)
275
+ subject.validate("xxxxxxxxxx").should eql(false)
276
+ subject.validate("BEFR").should eql(false)
269
277
  end
270
278
 
271
279
  it "allows Valvat instance as input" do
272
- Valvat::Syntax.validate(Valvat.new("DE345889003")).should eql(true)
273
- Valvat::Syntax.validate(Valvat.new("DE34588900X")).should eql(false)
280
+ subject.validate(Valvat.new("DE345889003")).should eql(true)
281
+ subject.validate(Valvat.new("DE34588900X")).should eql(false)
274
282
  end
275
283
  end
276
284
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: valvat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-16 00:00:00.000000000 Z
12
+ date: 2013-06-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: savon
@@ -173,12 +173,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
173
173
  - - ! '>='
174
174
  - !ruby/object:Gem::Version
175
175
  version: '0'
176
+ segments:
177
+ - 0
178
+ hash: 825797335108127097
176
179
  required_rubygems_version: !ruby/object:Gem::Requirement
177
180
  none: false
178
181
  requirements:
179
182
  - - ! '>='
180
183
  - !ruby/object:Gem::Version
181
184
  version: '0'
185
+ segments:
186
+ - 0
187
+ hash: 825797335108127097
182
188
  requirements: []
183
189
  rubyforge_project:
184
190
  rubygems_version: 1.8.23
@@ -192,4 +198,3 @@ test_files:
192
198
  - spec/valvat/syntax_spec.rb
193
199
  - spec/valvat/utils_spec.rb
194
200
  - spec/valvat_spec.rb
195
- has_rdoc: