has_validated_attributes 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 19e53c94ab09040c1ff212fc938d1dcd5dd2b3e0
4
- data.tar.gz: da2dee3ed009a0cd514552b0283d7ea2c3c3ab18
3
+ metadata.gz: ff26455749873443e5c6fd58805023d8eb3817ca
4
+ data.tar.gz: f478e0fd08a9d2fa4ecc417e51c8ba2eaff8456e
5
5
  SHA512:
6
- metadata.gz: c82d71c39f4968d0f4fedffa61d8bb97efd6597280a320c4277bec0e938db05c7f603f4fbbc8246c00d813181223f3822f165e9e46ea241ccc2145bf41edd984
7
- data.tar.gz: 36d277961397f335299fea37207e904c2ecfb4763a667194e76e0758383560afd989bd1e5156cbb36fcb4ad3ed9213b4706c7eb08f2d5dfdea0d74cfd70ecb35
6
+ metadata.gz: 2f41b9c2e5d73f30783940deab3665a035c9a483ab01a9f81f5e9bb61dbe7555b27848425bf1399149134eed72d9111f9946bef6426f73fe225f110e6000438e
7
+ data.tar.gz: e90a5548d856875e04554ceea2bac78da28436f99cf34d560f7edf88c6c49e4e0cc594e426470992248882408e252b72982a15e42864e13db4fe82daecd1a593
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
1
  --colour
2
- --format nested
2
+ --format documentation
data/.travis.yml CHANGED
@@ -1,5 +1,2 @@
1
- rvm:
2
- - 1.9.3
3
- - 1.9.2
4
-
1
+ rvm: "2.1.2"
5
2
  script: rake spec
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module HasValidatedAttributes
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -25,27 +25,27 @@ describe "HasValidatedAttributes" do
25
25
  it "should return error" do
26
26
  [">*,.<><", "<<< test", "Kansas City", "-- Hey --", "& youuuu", "21 Jump"].each do |value|
27
27
  @resource.username_attr = value
28
- @resource.valid?.should be_false
28
+ @resource.valid?.should be_falsey
29
29
  @resource.errors.full_messages.should == ["Username attr use only letters, numbers, and .-_@ please."]
30
30
  end
31
31
  end
32
32
 
33
33
  it "should return error with less than 5 chars" do
34
34
  @resource.username_attr = "test"
35
- @resource.valid?.should be_false
35
+ @resource.valid?.should be_falsey
36
36
  @resource.errors.full_messages.should == ["Username attr is too short (minimum is 5 characters)"]
37
37
  end
38
38
 
39
39
  it "should return error with more than 127 chars" do
40
40
  @resource.username_attr = "test" * 128
41
- @resource.valid?.should be_false
41
+ @resource.valid?.should be_falsey
42
42
  @resource.errors.full_messages.should == ["Username attr is too long (maximum is 127 characters)"]
43
43
  end
44
44
 
45
45
  it "should return ok" do
46
46
  ["kansascity", "kansascity@org1", "kansas.city@org1", "kansas_city@org1", "kansas-city", "1kc.-_@"].each do |value|
47
47
  @resource.username_attr = value
48
- @resource.valid?.should be_true
48
+ @resource.valid?.should be_truthy
49
49
  end
50
50
  end
51
51
  end
@@ -54,21 +54,21 @@ describe "HasValidatedAttributes" do
54
54
  it "should return error" do
55
55
  [">*", "< test"].each do |value|
56
56
  @resource.name_attr = value
57
- @resource.valid?.should be_false
57
+ @resource.valid?.should be_falsey
58
58
  @resource.errors.full_messages.should == ["Name attr avoid non-printing characters and \\&gt;&lt;/ please."]
59
59
  end
60
60
  end
61
61
 
62
62
  it "should return error with more than 10 chars" do
63
63
  @resource.name_attr = "test" * 6
64
- @resource.valid?.should be_false
64
+ @resource.valid?.should be_falsey
65
65
  @resource.errors.full_messages.should == ["Name attr is too long (maximum is 10 characters)"]
66
66
  end
67
67
 
68
68
  it "should return ok" do
69
69
  ["k c", "- H-", " t", "& u", "21 ", "brok", nil].each do |value|
70
70
  @resource.name_attr = value
71
- @resource.valid?.should be_true
71
+ @resource.valid?.should be_truthy
72
72
  end
73
73
  end
74
74
  end
@@ -77,21 +77,21 @@ describe "HasValidatedAttributes" do
77
77
  it "should return error" do
78
78
  ["Abc.example.com", "A@b@c@example.com", "()[]\;:,<>@example.com", "abc@example.comar"].each do |value|
79
79
  @resource.email_attr = value
80
- @resource.valid?.should be_false
80
+ @resource.valid?.should be_falsey
81
81
  @resource.errors.full_messages.should == ["Email attr should look like an email address."]
82
82
  end
83
83
  end
84
84
 
85
85
  it "should return error with more than 63 chars" do
86
86
  @resource.email_attr = "test@example.com" * 64
87
- @resource.valid?.should be_false
87
+ @resource.valid?.should be_falsey
88
88
  @resource.errors.full_messages.should == ["Email attr is too long (maximum is 63 characters)", "Email attr should look like an email address."]
89
89
  end
90
90
 
91
91
  ["abc@example.com", "Abc@example.com", "aBC@example.com", "abc.123@example.com", "mo’reilly@example.com", "ro'sullivan@example.com"].each do |value|
92
92
  it "should return ok for `#{ value }`" do
93
93
  @resource.email_attr = value
94
- @resource.valid?.should be_true
94
+ @resource.valid?.should be_truthy
95
95
  end
96
96
  end
97
97
  end
@@ -100,7 +100,7 @@ describe "HasValidatedAttributes" do
100
100
  it "should return error" do
101
101
  [">*", "< test", "www.test..com", "www.test.c", "www-test.com", "abc", "123", "&*()", "www.test-com"].each do |value|
102
102
  @resource.phone_number_attr = value
103
- @resource.valid?.should be_false
103
+ @resource.valid?.should be_falsey
104
104
  @resource.errors.full_messages.should == ["Phone number attr accepts only 10 numbers and (),.- characters and must not be all 0s"]
105
105
  end
106
106
  end
@@ -108,7 +108,7 @@ describe "HasValidatedAttributes" do
108
108
  it "should return ok" do
109
109
  ["9134456677", "5444456677"].each do |value|
110
110
  @resource.phone_number_attr = value
111
- @resource.valid?.should be_true
111
+ @resource.valid?.should be_truthy
112
112
  end
113
113
  end
114
114
  end
@@ -117,7 +117,7 @@ describe "HasValidatedAttributes" do
117
117
  it "should return error" do
118
118
  ["-1", "qwert"].each do |value|
119
119
  @resource.phone_extension_attr = value
120
- @resource.valid?.should be_false
120
+ @resource.valid?.should be_falsey
121
121
  @resource.errors.full_messages.should == ["Phone extension attr accepts only numbers (0-9)"]
122
122
  end
123
123
  end
@@ -125,7 +125,7 @@ describe "HasValidatedAttributes" do
125
125
  it "should return ok" do
126
126
  ["123", "123456"].each do |value|
127
127
  @resource.phone_extension_attr = value
128
- @resource.valid?.should be_true
128
+ @resource.valid?.should be_truthy
129
129
  end
130
130
  end
131
131
  end
@@ -135,14 +135,14 @@ describe "HasValidatedAttributes" do
135
135
  it "should return error" do
136
136
  [">*", "<test", "test-er"].each do |value|
137
137
  @resource.domain_attr = value
138
- @resource.valid?.should be_false
138
+ @resource.valid?.should be_falsey
139
139
  @resource.errors.full_messages.should == ["Domain attr should look like a domain name."]
140
140
  end
141
141
  end
142
142
 
143
143
  it "should return error with more than 63 chars" do
144
144
  @resource.domain_attr = "a" * 64 + ".com"
145
- @resource.valid?.should be_false
145
+ @resource.valid?.should be_falsey
146
146
  @resource.errors.full_messages.should == ["Domain attr is too long (maximum is 63 characters)"]
147
147
  end
148
148
 
@@ -150,7 +150,7 @@ describe "HasValidatedAttributes" do
150
150
  it "should return ok" do
151
151
  ["test.com", "hey.com", "dynamicadvisorsgroup.com", "advisorsexcel.com"].each do |value|
152
152
  @resource.domain_attr = value
153
- @resource.valid?.should be_true
153
+ @resource.valid?.should be_truthy
154
154
  end
155
155
  end
156
156
  end
@@ -159,7 +159,7 @@ describe "HasValidatedAttributes" do
159
159
  it "should return error" do
160
160
  ["5555", "5555555555","-99999"].each do |value|
161
161
  @resource.zipcode_attr = value
162
- @resource.valid?.should be_false
162
+ @resource.valid?.should be_falsey
163
163
  @resource.errors.full_messages.should == ["Zipcode attr must contain 5 or 9 numbers"]
164
164
  end
165
165
  end
@@ -167,7 +167,7 @@ describe "HasValidatedAttributes" do
167
167
  it "should return ok" do
168
168
  ["11111", "333333333"].each do |value|
169
169
  @resource.zipcode_attr = value
170
- @resource.valid?.should be_true
170
+ @resource.valid?.should be_truthy
171
171
  end
172
172
  end
173
173
  end
@@ -177,7 +177,7 @@ describe "HasValidatedAttributes" do
177
177
  it "should return error" do
178
178
  ["k c", "55555", "55555-5555", "55555 5555", "55555.5555", "(888)88-9999", " ,-99999"].each do |value|
179
179
  @resource.middle_initial_attr = value
180
- @resource.valid?.should be_false
180
+ @resource.valid?.should be_falsey
181
181
  @resource.errors.full_messages.should == ["Middle initial attr accepts only one letter"]
182
182
  end
183
183
  end
@@ -185,7 +185,7 @@ describe "HasValidatedAttributes" do
185
185
  it "should return ok" do
186
186
  ["a", "A"].each do |value|
187
187
  @resource.middle_initial_attr = value
188
- @resource.valid?.should be_true
188
+ @resource.valid?.should be_truthy
189
189
  end
190
190
  end
191
191
  end
@@ -194,7 +194,7 @@ describe "HasValidatedAttributes" do
194
194
  it "should return error" do
195
195
  ["0.2222"].each do |value|
196
196
  @resource.dollar_attr = value
197
- @resource.valid?.should be_false
197
+ @resource.valid?.should be_falsey
198
198
  @resource.errors.full_messages.should == ["Dollar attr accepts only numeric characters, period, and negative sign"]
199
199
  end
200
200
  end
@@ -202,7 +202,7 @@ describe "HasValidatedAttributes" do
202
202
  it "should return ok" do
203
203
  ["0", "1", "100", "1000", "-1000.99"].each do |value|
204
204
  @resource.dollar_attr = value
205
- @resource.valid?.should be_true
205
+ @resource.valid?.should be_truthy
206
206
  end
207
207
  end
208
208
  end
@@ -212,7 +212,7 @@ describe "HasValidatedAttributes" do
212
212
  it "should return error" do
213
213
  ["-0.2", "-1"].each do |value|
214
214
  @resource.positive_dollar_attr = value
215
- @resource.valid?.should be_false
215
+ @resource.valid?.should be_falsey
216
216
  @resource.errors.full_messages.should == ["Positive dollar attr accepts only numeric characters, period", "Positive dollar attr must be greater than or equal to 0"]
217
217
  end
218
218
  end
@@ -220,7 +220,7 @@ describe "HasValidatedAttributes" do
220
220
  it "should return ok" do
221
221
  ["1", "100", "1000", "1000.99"].each do |value|
222
222
  @resource.positive_dollar_attr = value
223
- @resource.valid?.should be_true
223
+ @resource.valid?.should be_truthy
224
224
  end
225
225
  end
226
226
  end
@@ -229,7 +229,7 @@ describe "HasValidatedAttributes" do
229
229
  it "should return error" do
230
230
  ["ewqr", "&"].each do |value|
231
231
  @resource.percent_attr = value
232
- @resource.valid?.should be_false
232
+ @resource.valid?.should be_falsey
233
233
  @resource.errors.full_messages.should == ["Percent attr accepts only numeric characters, period, negative sign, and must be equal/less/greater than +/- 100"]
234
234
  end
235
235
  end
@@ -237,7 +237,7 @@ describe "HasValidatedAttributes" do
237
237
  it "should return ok" do
238
238
  ["99.999", "0.001", "99"].each do |value|
239
239
  @resource.percent_attr = value
240
- @resource.valid?.should be_true
240
+ @resource.valid?.should be_truthy
241
241
  end
242
242
  end
243
243
  end
@@ -247,7 +247,7 @@ describe "HasValidatedAttributes" do
247
247
  it "should return error" do
248
248
  ["-100"].each do |value|
249
249
  @resource.positive_percent_attr = value
250
- @resource.valid?.should be_false
250
+ @resource.valid?.should be_falsey
251
251
  @resource.errors.full_messages.should == ["Positive percent attr accepts only numeric characters, period, and must be less than 100", "Positive percent attr must be greater than or equal to 0"]
252
252
  end
253
253
  end
@@ -255,7 +255,7 @@ describe "HasValidatedAttributes" do
255
255
  it "should return ok" do
256
256
  ["99.999", "0.001", "99"].each do |value|
257
257
  @resource.positive_percent_attr = value
258
- @resource.valid?.should be_true
258
+ @resource.valid?.should be_truthy
259
259
  end
260
260
  end
261
261
  end
@@ -264,7 +264,7 @@ describe "HasValidatedAttributes" do
264
264
  it "should return error" do
265
265
  ["ewqr", "&", "test.c", "www.test", "test.", "www-test.com"].each do |value|
266
266
  @resource.url_attr = value
267
- @resource.valid?.should be_false
267
+ @resource.valid?.should be_falsey
268
268
  @resource.errors.full_messages.should == ["Url attr web address isnt valid"]
269
269
  end
270
270
  end
@@ -272,7 +272,7 @@ describe "HasValidatedAttributes" do
272
272
  it "should return ok" do
273
273
  ["http://www.example.com", "http://fiance.example.com"].each do |value|
274
274
  @resource.url_attr = value
275
- @resource.valid?.should be_true
275
+ @resource.valid?.should be_truthy
276
276
  end
277
277
  end
278
278
  end
@@ -281,7 +281,7 @@ describe "HasValidatedAttributes" do
281
281
  it "should return error" do
282
282
  ["111-111-111"].each do |value|
283
283
  @resource.ssn_attr = value
284
- @resource.valid?.should be_false
284
+ @resource.valid?.should be_falsey
285
285
  @resource.errors.full_messages.should == ["Ssn attr is the wrong length (should be 9 characters)", "Ssn attr must be in the format 111-11-1111"]
286
286
  end
287
287
  end
@@ -289,7 +289,7 @@ describe "HasValidatedAttributes" do
289
289
  it "should return ok" do
290
290
  ["111111111"].each do |value|
291
291
  @resource.ssn_attr = value
292
- @resource.valid?.should be_true
292
+ @resource.valid?.should be_truthy
293
293
  end
294
294
  end
295
295
  end
@@ -297,14 +297,14 @@ describe "HasValidatedAttributes" do
297
297
  describe "#taxid" do
298
298
  it "should return error" do
299
299
  @resource.taxid_attr = "ab-cdefgh"
300
- @resource.valid?.should be_false
300
+ @resource.valid?.should be_falsey
301
301
  @resource.errors.full_messages.should == ["Taxid attr must be in the format 11-1111111"]
302
302
  end
303
303
 
304
304
  it "should return error is is less or more than 9 chars" do
305
305
  ["111", "1111111111"].each do |value|
306
306
  @resource.taxid_attr = value
307
- @resource.valid?.should be_false
307
+ @resource.valid?.should be_falsey
308
308
  @resource.errors.full_messages.should == ["Taxid attr is the wrong length (should be 9 characters)", "Taxid attr must be in the format 11-1111111"]
309
309
  end
310
310
  end
@@ -312,7 +312,7 @@ describe "HasValidatedAttributes" do
312
312
  it "should return ok" do
313
313
  ["111111111"].each do |value|
314
314
  @resource.taxid_attr = value
315
- @resource.valid?.should be_true
315
+ @resource.valid?.should be_truthy
316
316
  end
317
317
  end
318
318
  end
@@ -321,14 +321,14 @@ describe "HasValidatedAttributes" do
321
321
  describe "#age" do
322
322
  it "should return error" do
323
323
  @resource.age_attr = "111"
324
- @resource.valid?.should be_false
324
+ @resource.valid?.should be_falsey
325
325
  @resource.errors.full_messages.should == ["Age attr must contain only 3 numbers and less than 110"]
326
326
  end
327
327
 
328
328
  it "should return ok" do
329
329
  ["1", "10", "100"].each do |value|
330
330
  @resource.age_attr = value
331
- @resource.valid?.should be_true
331
+ @resource.valid?.should be_truthy
332
332
  end
333
333
  end
334
334
  end
@@ -336,14 +336,14 @@ describe "HasValidatedAttributes" do
336
336
  describe "#number" do
337
337
  it "should return error" do
338
338
  @resource.number_attr = "aaa"
339
- @resource.valid?.should be_false
339
+ @resource.valid?.should be_falsey
340
340
  @resource.errors.full_messages.should == ["Number attr accepts only numbers (0-9)"]
341
341
  end
342
342
 
343
343
  it "should return ok" do
344
344
  ["1", "10", "100"].each do |value|
345
345
  @resource.number_attr = value
346
- @resource.valid?.should be_true
346
+ @resource.valid?.should be_truthy
347
347
  end
348
348
  end
349
349
  end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require "active_support"
2
2
  require "active_record"
3
3
  require "database_cleaner"
4
+ require "yaml"
4
5
 
5
6
  ENV['debug'] = 'test' unless ENV['debug']
6
7
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: has_validated_attributes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Ginavan