phony_rails 0.12.6 → 0.12.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +291 -0
- data/Gemfile +4 -4
- data/Gemfile.lock +49 -35
- data/README.md +3 -1
- data/lib/phony_rails/locales/he.yml +4 -0
- data/lib/phony_rails/version.rb +1 -1
- data/spec/lib/phony_rails_spec.rb +134 -129
- data/spec/lib/validators/phony_validator_spec.rb +56 -56
- metadata +4 -2
@@ -143,25 +143,25 @@ describe PhonyPlausibleValidator do
|
|
143
143
|
end
|
144
144
|
|
145
145
|
it "should validate an empty number" do
|
146
|
-
@home.
|
146
|
+
expect(@home).to be_valid
|
147
147
|
end
|
148
148
|
|
149
149
|
it "should validate a valid number" do
|
150
150
|
@home.phone_number = VALID_NUMBER
|
151
|
-
@home.
|
151
|
+
expect(@home).to be_valid
|
152
152
|
end
|
153
153
|
|
154
154
|
it "should invalidate an invalid number" do
|
155
155
|
@home.phone_number = INVALID_NUMBER
|
156
|
-
@home.
|
157
|
-
@home.errors.messages.
|
156
|
+
expect(@home).to_not be_valid
|
157
|
+
expect(@home.errors.messages).to include(:phone_number => ["is an invalid number"])
|
158
158
|
end
|
159
159
|
|
160
160
|
it "should translate the error message in English" do
|
161
161
|
I18n.with_locale(:en) do
|
162
162
|
@home.phone_number = INVALID_NUMBER
|
163
163
|
@home.valid?
|
164
|
-
@home.errors.messages.
|
164
|
+
expect(@home.errors.messages).to include(:phone_number => ["is an invalid number"])
|
165
165
|
end
|
166
166
|
end
|
167
167
|
|
@@ -169,7 +169,7 @@ describe PhonyPlausibleValidator do
|
|
169
169
|
I18n.with_locale(:fr) do
|
170
170
|
@home.phone_number = INVALID_NUMBER
|
171
171
|
@home.valid?
|
172
|
-
@home.errors.messages.
|
172
|
+
expect(@home.errors.messages).to include(:phone_number => ["est un numéro invalide"])
|
173
173
|
end
|
174
174
|
end
|
175
175
|
|
@@ -177,7 +177,7 @@ describe PhonyPlausibleValidator do
|
|
177
177
|
I18n.with_locale(:ja) do
|
178
178
|
@home.phone_number = INVALID_NUMBER
|
179
179
|
@home.valid?
|
180
|
-
@home.errors.messages.
|
180
|
+
expect(@home.errors.messages).to include(:phone_number => ["は正しい電話番号ではありません"])
|
181
181
|
end
|
182
182
|
end
|
183
183
|
|
@@ -185,7 +185,7 @@ describe PhonyPlausibleValidator do
|
|
185
185
|
I18n.with_locale(:km) do
|
186
186
|
@home.phone_number = INVALID_NUMBER
|
187
187
|
@home.valid?
|
188
|
-
@home.errors.messages.
|
188
|
+
expect(@home.errors.messages).to include(:phone_number => ["គឺជាលេខមិនត្រឹមត្រូវ"])
|
189
189
|
end
|
190
190
|
end
|
191
191
|
end
|
@@ -205,18 +205,18 @@ describe ActiveModel::Validations::HelperMethods do
|
|
205
205
|
end
|
206
206
|
|
207
207
|
it "should validate an empty number" do
|
208
|
-
@home.
|
208
|
+
expect(@home).to be_valid
|
209
209
|
end
|
210
210
|
|
211
211
|
it "should validate a valid number" do
|
212
212
|
@home.phone_number = VALID_NUMBER
|
213
|
-
@home.
|
213
|
+
expect(@home).to be_valid
|
214
214
|
end
|
215
215
|
|
216
216
|
it "should invalidate an invalid number" do
|
217
217
|
@home.phone_number = INVALID_NUMBER
|
218
|
-
@home.
|
219
|
-
@home.errors.messages.
|
218
|
+
expect(@home).to_not be_valid
|
219
|
+
expect(@home.errors.messages).to include(:phone_number => ["is an invalid number"])
|
220
220
|
end
|
221
221
|
|
222
222
|
end
|
@@ -229,19 +229,19 @@ describe ActiveModel::Validations::HelperMethods do
|
|
229
229
|
end
|
230
230
|
|
231
231
|
it "should invalidate an empty number" do
|
232
|
-
@home.
|
233
|
-
@home.errors.messages.
|
232
|
+
expect(@home).to_not be_valid
|
233
|
+
expect(@home.errors.messages).to include(:phone_number => ["can't be blank"])
|
234
234
|
end
|
235
235
|
|
236
236
|
it "should validate a valid number" do
|
237
237
|
@home.phone_number = VALID_NUMBER
|
238
|
-
@home.
|
238
|
+
expect(@home).to be_valid
|
239
239
|
end
|
240
240
|
|
241
241
|
it "should invalidate an invalid number" do
|
242
242
|
@home.phone_number = INVALID_NUMBER
|
243
|
-
@home.
|
244
|
-
@home.errors.messages.
|
243
|
+
expect(@home).to_not be_valid
|
244
|
+
expect(@home.errors.messages).to include(:phone_number => ["is an invalid number"])
|
245
245
|
end
|
246
246
|
|
247
247
|
end
|
@@ -254,18 +254,18 @@ describe ActiveModel::Validations::HelperMethods do
|
|
254
254
|
end
|
255
255
|
|
256
256
|
it "should validate an empty number" do
|
257
|
-
@home.
|
257
|
+
expect(@home).to be_valid
|
258
258
|
end
|
259
259
|
|
260
260
|
it "should validate a valid number" do
|
261
261
|
@home.phone_number = VALID_NUMBER
|
262
|
-
@home.
|
262
|
+
expect(@home).to be_valid
|
263
263
|
end
|
264
264
|
|
265
265
|
it "should invalidate an invalid number" do
|
266
266
|
@home.phone_number = INVALID_NUMBER
|
267
|
-
@home.
|
268
|
-
@home.errors.messages.
|
267
|
+
expect(@home).to_not be_valid
|
268
|
+
expect(@home.errors.messages).to include(:phone_number => ["is an invalid number"])
|
269
269
|
end
|
270
270
|
|
271
271
|
end
|
@@ -278,19 +278,19 @@ describe ActiveModel::Validations::HelperMethods do
|
|
278
278
|
end
|
279
279
|
|
280
280
|
it "should invalidate an empty number" do
|
281
|
-
@home.
|
282
|
-
@home.errors.messages.
|
281
|
+
expect(@home).to_not be_valid
|
282
|
+
expect(@home.errors.messages).to include(:phone_number => ["is invalid"])
|
283
283
|
end
|
284
284
|
|
285
285
|
it "should validate a well formatted valid number" do
|
286
286
|
@home.phone_number = "+#{VALID_NUMBER}"
|
287
|
-
@home.
|
287
|
+
expect(@home).to be_valid
|
288
288
|
end
|
289
289
|
|
290
290
|
it "should invalidate a bad formatted valid number" do
|
291
291
|
@home.phone_number = VALID_NUMBER
|
292
|
-
@home.
|
293
|
-
@home.errors.messages.
|
292
|
+
expect(@home).to_not be_valid
|
293
|
+
expect(@home.errors.messages).to include(:phone_number => ["is invalid"])
|
294
294
|
end
|
295
295
|
|
296
296
|
end
|
@@ -303,18 +303,18 @@ describe ActiveModel::Validations::HelperMethods do
|
|
303
303
|
end
|
304
304
|
|
305
305
|
it "should validate an empty number" do
|
306
|
-
@home.
|
306
|
+
expect(@home).to be_valid
|
307
307
|
end
|
308
308
|
|
309
309
|
it "should validate a well formatted valid number" do
|
310
310
|
@home.phone_number = VALID_NUMBER
|
311
|
-
@home.
|
311
|
+
expect(@home).to be_valid
|
312
312
|
end
|
313
313
|
|
314
314
|
it "should invalidate a bad formatted valid number" do
|
315
315
|
@home.phone_number = "+#{VALID_NUMBER}"
|
316
|
-
@home.
|
317
|
-
@home.errors.messages.
|
316
|
+
expect(@home).to_not be_valid
|
317
|
+
expect(@home.errors.messages).to include(:phone_number => ["is invalid"])
|
318
318
|
end
|
319
319
|
|
320
320
|
end
|
@@ -327,24 +327,24 @@ describe ActiveModel::Validations::HelperMethods do
|
|
327
327
|
end
|
328
328
|
|
329
329
|
it "should validate an empty number" do
|
330
|
-
@home.
|
330
|
+
expect(@home).to be_valid
|
331
331
|
end
|
332
332
|
|
333
333
|
it "should validate a valid number with the right country code" do
|
334
334
|
@home.phone_number = AUSTRALIAN_NUMBER_WITH_COUNTRY_CODE
|
335
|
-
@home.
|
335
|
+
expect(@home).to be_valid
|
336
336
|
end
|
337
337
|
|
338
338
|
it "should invalidate a valid number with the wrong country code" do
|
339
339
|
@home.phone_number = FRENCH_NUMBER_WITH_COUNTRY_CODE
|
340
|
-
@home.
|
341
|
-
@home.errors.messages.
|
340
|
+
expect(@home).to_not be_valid
|
341
|
+
expect(@home.errors.messages).to include(:phone_number => ["is an invalid number"])
|
342
342
|
end
|
343
343
|
|
344
344
|
it "should invalidate a valid number without a country code" do
|
345
345
|
@home.phone_number = VALID_NUMBER
|
346
|
-
@home.
|
347
|
-
@home.errors.messages.
|
346
|
+
expect(@home).to_not be_valid
|
347
|
+
expect(@home.errors.messages).to include(:phone_number => ["is an invalid number"])
|
348
348
|
end
|
349
349
|
|
350
350
|
end
|
@@ -357,23 +357,23 @@ describe ActiveModel::Validations::HelperMethods do
|
|
357
357
|
end
|
358
358
|
|
359
359
|
it "should validate an empty number" do
|
360
|
-
@home.
|
360
|
+
expect(@home).to be_valid
|
361
361
|
end
|
362
362
|
|
363
363
|
it "should validate a valid number" do
|
364
364
|
@home.phone_number = VALID_NUMBER
|
365
|
-
@home.
|
365
|
+
expect(@home).to be_valid
|
366
366
|
end
|
367
367
|
|
368
368
|
it "should validate a normalizable number" do
|
369
369
|
@home.phone_number = NORMALIZABLE_NUMBER
|
370
|
-
@home.
|
370
|
+
expect(@home).to be_valid
|
371
371
|
end
|
372
372
|
|
373
373
|
it "should invalidate an invalid number" do
|
374
374
|
@home.phone_number = INVALID_NUMBER
|
375
|
-
@home.
|
376
|
-
@home.errors.messages.
|
375
|
+
expect(@home).to_not be_valid
|
376
|
+
expect(@home.errors.messages).to include(:phone_number => ["is an invalid number"])
|
377
377
|
end
|
378
378
|
|
379
379
|
end
|
@@ -386,24 +386,24 @@ describe ActiveModel::Validations::HelperMethods do
|
|
386
386
|
end
|
387
387
|
|
388
388
|
it "should validate an empty number" do
|
389
|
-
@home.
|
389
|
+
expect(@home).to be_valid
|
390
390
|
end
|
391
391
|
|
392
392
|
it "should validate a valid number with the right country code" do
|
393
393
|
@home.phone_number = POLISH_NUMBER_WITH_COUNTRY_CODE
|
394
|
-
@home.
|
394
|
+
expect(@home).to be_valid
|
395
395
|
end
|
396
396
|
|
397
397
|
it "should invalidate a valid number with the wrong country code" do
|
398
398
|
@home.phone_number = FRENCH_NUMBER_WITH_COUNTRY_CODE
|
399
|
-
@home.
|
400
|
-
@home.errors.messages.
|
399
|
+
expect(@home).to_not be_valid
|
400
|
+
expect(@home.errors.messages).to include(:phone_number => ["is an invalid number"])
|
401
401
|
end
|
402
402
|
|
403
403
|
it "should invalidate a valid number without a country code" do
|
404
404
|
@home.phone_number = VALID_NUMBER
|
405
|
-
@home.
|
406
|
-
@home.errors.messages.
|
405
|
+
expect(@home).to_not be_valid
|
406
|
+
expect(@home.errors.messages).to include(:phone_number => ["is an invalid number"])
|
407
407
|
end
|
408
408
|
|
409
409
|
end
|
@@ -415,30 +415,30 @@ describe ActiveModel::Validations::HelperMethods do
|
|
415
415
|
end
|
416
416
|
|
417
417
|
it "should invalidate an empty number" do
|
418
|
-
@home.
|
418
|
+
expect(@home).to_not be_valid
|
419
419
|
end
|
420
420
|
|
421
421
|
it "should invalidate an invalid number" do
|
422
422
|
@home.phone_number = INVALID_NUMBER
|
423
|
-
@home.
|
424
|
-
@home.errors.messages[:phone_number].
|
423
|
+
expect(@home).to_not be_valid
|
424
|
+
expect(@home.errors.messages[:phone_number]).to include "is an invalid number"
|
425
425
|
end
|
426
426
|
|
427
427
|
it "should invalidate a badly formatted number with the right country code" do
|
428
428
|
@home.phone_number = FRENCH_NUMBER_WITH_COUNTRY_CODE
|
429
|
-
@home.
|
430
|
-
@home.errors.messages[:phone_number].
|
429
|
+
expect(@home).to_not be_valid
|
430
|
+
expect(@home.errors.messages[:phone_number]).to include "is invalid"
|
431
431
|
end
|
432
432
|
|
433
433
|
it "should invalidate a properly formatted number with the wrong country code" do
|
434
434
|
@home.phone_number = FORMATTED_AUSTRALIAN_NUMBER_WITH_COUNTRY_CODE
|
435
|
-
@home.
|
436
|
-
@home.errors.messages[:phone_number].
|
435
|
+
expect(@home).to_not be_valid
|
436
|
+
expect(@home.errors.messages[:phone_number]).to include "is an invalid number"
|
437
437
|
end
|
438
438
|
|
439
439
|
it "should validate a properly formatted number with the right country code" do
|
440
440
|
@home.phone_number = FORMATTED_FRENCH_NUMBER_WITH_COUNTRY_CODE
|
441
|
-
@home.
|
441
|
+
expect(@home).to be_valid
|
442
442
|
end
|
443
443
|
|
444
444
|
end
|
@@ -452,7 +452,7 @@ describe ActiveModel::Validations::HelperMethods do
|
|
452
452
|
end
|
453
453
|
|
454
454
|
it "should allow this number" do
|
455
|
-
@home.
|
455
|
+
expect(@home).to be_valid
|
456
456
|
end
|
457
457
|
end
|
458
458
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phony_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joost Hietbrink
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: phony
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- ".gitignore"
|
98
98
|
- ".rspec"
|
99
99
|
- ".travis.yml"
|
100
|
+
- CHANGELOG.md
|
100
101
|
- Gemfile
|
101
102
|
- Gemfile.lock
|
102
103
|
- Guardfile
|
@@ -107,6 +108,7 @@ files:
|
|
107
108
|
- lib/phony_rails/locales/de.yml
|
108
109
|
- lib/phony_rails/locales/en.yml
|
109
110
|
- lib/phony_rails/locales/fr.yml
|
111
|
+
- lib/phony_rails/locales/he.yml
|
110
112
|
- lib/phony_rails/locales/it.yml
|
111
113
|
- lib/phony_rails/locales/ja.yml
|
112
114
|
- lib/phony_rails/locales/km.yml
|