phony 2.18.3 → 2.20.5
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/README.textile +5 -1
- data/lib/phony/countries/argentina.rb +355 -0
- data/lib/phony/countries/austria.rb +2 -2
- data/lib/phony/countries/cambodia.rb +1 -5
- data/lib/phony/countries/china.rb +5 -2
- data/lib/phony/countries/germany.rb +1 -1
- data/lib/phony/countries/ireland.rb +6 -4
- data/lib/phony/countries/italy.rb +34 -17
- data/lib/phony/countries/japan.rb +58 -8
- data/lib/phony/countries/libya.rb +1 -1
- data/lib/phony/countries/serbia.rb +5 -1
- data/lib/phony/countries/taiwan.rb +1 -0
- data/lib/phony/countries/vietnam.rb +1 -0
- data/lib/phony/countries.rb +83 -53
- data/lib/phony/country.rb +8 -2
- data/lib/phony/country_codes.rb +15 -2
- data/lib/phony/dsl.rb +2 -2
- data/lib/phony/local_splitters/fixed.rb +2 -0
- data/lib/phony/national_code.rb +1 -1
- data/lib/phony/national_splitters/none.rb +1 -3
- data/lib/phony/trunk_code.rb +5 -5
- data/lib/phony.rb +1 -0
- data/spec/functional/config_spec.rb +5 -5
- data/spec/functional/plausibility_spec.rb +82 -16
- data/spec/lib/phony/countries_spec.rb +86 -23
- data/spec/lib/phony/country_codes_spec.rb +82 -58
- data/spec/lib/phony/country_spec.rb +29 -9
- data/spec/lib/phony/dsl_spec.rb +6 -2
- data/spec/lib/phony/local_splitters/regex_spec.rb +12 -15
- data/spec/lib/phony/national_code_spec.rb +15 -45
- data/spec/lib/phony/national_splitters/fixed_spec.rb +12 -16
- data/spec/lib/phony/national_splitters/none_spec.rb +3 -3
- data/spec/lib/phony/national_splitters/variable_spec.rb +9 -13
- data/spec/lib/phony/trunk_code_spec.rb +85 -0
- data/spec/lib/phony/vanity_spec.rb +4 -4
- metadata +21 -19
@@ -25,11 +25,11 @@ describe 'plausibility' do
|
|
25
25
|
incorrect = [shortest.sub(/\d\s*\z/, '')] # , longest + '0']
|
26
26
|
|
27
27
|
correct.each do |value|
|
28
|
-
Phony.plausible?(value).
|
28
|
+
expect(Phony.plausible?(value)).to be_truthy,
|
29
29
|
"It should validate #{value}, but does not."
|
30
30
|
end
|
31
31
|
incorrect.each do |value|
|
32
|
-
Phony.plausible?(value).
|
32
|
+
expect(Phony.plausible?(value)).to be_falsey,
|
33
33
|
"It should not validate #{value}, but does."
|
34
34
|
end
|
35
35
|
end
|
@@ -38,7 +38,7 @@ describe 'plausibility' do
|
|
38
38
|
invalid = [*sample]
|
39
39
|
|
40
40
|
invalid.each do |value|
|
41
|
-
Phony.plausible?(value).
|
41
|
+
expect(Phony.plausible?(value)).to be_falsey,
|
42
42
|
"It should not validate #{value}, but does."
|
43
43
|
end
|
44
44
|
end
|
@@ -46,7 +46,8 @@ describe 'plausibility' do
|
|
46
46
|
end
|
47
47
|
|
48
48
|
context 'specific countries' do
|
49
|
-
it_is_correct_for 'Austria', :samples => '+43 720 116987' # VoIP
|
49
|
+
it_is_correct_for 'Austria', :samples => ['+43 720 116987', # VoIP
|
50
|
+
'+43 463 12345'] # Klagenfurt
|
50
51
|
it_is_correct_for 'Bosnia and Herzegovina', :samples => ['+387 66 666 666',
|
51
52
|
'+387 37 123 456',
|
52
53
|
'+387 33 222 111']
|
@@ -178,6 +179,14 @@ describe 'plausibility' do
|
|
178
179
|
Phony.plausible?('+359 998 123456').should be_truthy
|
179
180
|
Phony.plausible?('+359 999 123456').should be_truthy
|
180
181
|
end
|
182
|
+
it_is_correct_for 'Colombia', :samples => ['+57 601 411 1899',
|
183
|
+
'+57 602 111 2222',
|
184
|
+
'+57 603 111 2222',
|
185
|
+
'+57 604 111 2222',
|
186
|
+
'+57 605 111 2222',
|
187
|
+
'+57 606 111 2222',
|
188
|
+
'+57 607 111 2222',
|
189
|
+
'+57 608 111 2222']
|
181
190
|
it_is_correct_for 'Congo', :samples => '+242 1234 56789'
|
182
191
|
it_is_correct_for 'Cook Islands', :samples => '+682 71928'
|
183
192
|
it_is_correct_for 'Costa Rica', :samples => '+506 2 234 5678'
|
@@ -191,7 +200,7 @@ describe 'plausibility' do
|
|
191
200
|
Phony.plausible?('+385 60 12 345').should be_truthy # Premium rate
|
192
201
|
Phony.plausible?('+385 62 123 456').should be_truthy # Premium, personal and UAN
|
193
202
|
end
|
194
|
-
it_is_correct_for "Côte d'Ivoire", :samples => '+225
|
203
|
+
it_is_correct_for "Côte d'Ivoire", :samples => '+225 01 9358 8764'
|
195
204
|
it_is_correct_for 'Democratic Republic of Timor-Leste', :samples => ['+670 465 7886', '+670 7465 7886']
|
196
205
|
it_is_correct_for 'Democratic Republic of the Congo', :samples => '+243 80 864 9794'
|
197
206
|
it_is_correct_for 'Diego Garcia', :samples => '+246 123 7686'
|
@@ -248,9 +257,17 @@ describe 'plausibility' do
|
|
248
257
|
end
|
249
258
|
it_is_correct_for 'French Guiana (French Department of)', :samples => '+594 594 123 456'
|
250
259
|
it_is_correct_for "French Polynesia (Territoire français d'outre-mer)", :samples => '+689 87 27 84 00'
|
251
|
-
|
260
|
+
it 'is correct for Gabon' do
|
261
|
+
Phony.plausible?('+241 1 627 739').should be_truthy
|
262
|
+
Phony.plausible?('+241 12 34 56 78').should be_truthy
|
263
|
+
end
|
264
|
+
# it_is_correct_for 'Gabonese Republic', :samples => [
|
265
|
+
# '+241 1 627 739',
|
266
|
+
# '+241 12 34 56 78',
|
267
|
+
# ]
|
252
268
|
it_is_correct_for 'Gambia', :samples => '+220 989 5148'
|
253
269
|
it_is_correct_for 'Germany', :samples => [
|
270
|
+
'+49 69 155 1',
|
254
271
|
'+49 1577 536 8701'
|
255
272
|
]
|
256
273
|
it_is_correct_for 'Georgia', :samples => ['+995 220 123 45',
|
@@ -276,7 +293,7 @@ describe 'plausibility' do
|
|
276
293
|
'+964 71 1234 5678']
|
277
294
|
|
278
295
|
|
279
|
-
it_is_correct_for 'Kiribati (Republic of)', :samples => '+686
|
296
|
+
it_is_correct_for 'Kiribati (Republic of)', :samples => '+686 34814527'
|
280
297
|
it_is_correct_for "Democratic People's Republic of Korea", :samples => ['+850 2 123 45',
|
281
298
|
'+850 2 123 456 789',
|
282
299
|
'+850 2 381 2356',
|
@@ -315,10 +332,19 @@ describe 'plausibility' do
|
|
315
332
|
it_is_correct_for 'Macedonia', :samples => ['+389 2 123 4567',
|
316
333
|
'+389 7 124 3456',
|
317
334
|
'+389 7 234 5678']
|
318
|
-
it_is_correct_for 'Madagascar', :samples => ['+261 20
|
319
|
-
'+261
|
320
|
-
'+261
|
321
|
-
'+261
|
335
|
+
it_is_correct_for 'Madagascar', :samples => ['+261 20 23 456 78',
|
336
|
+
'+261 32 34 546 78',
|
337
|
+
'+261 33 34 546 78',
|
338
|
+
'+261 34 34 546 78',
|
339
|
+
'+261 38 34 546 78']
|
340
|
+
it 'is incorrect for Madagascar' do
|
341
|
+
Phony.plausible?('+261 20 012 345 678').should be_falsey
|
342
|
+
Phony.plausible?('+261 20 12 434 569').should be_falsey
|
343
|
+
Phony.plausible?('+261 51 23 4567 8').should be_falsey
|
344
|
+
Phony.plausible?('+261 34 345 46789').should be_falsey
|
345
|
+
Phony.plausible?('+261 34 345 467').should be_falsey
|
346
|
+
end
|
347
|
+
|
322
348
|
it_is_correct_for 'Malawi', :samples => ['+265 1725 123',
|
323
349
|
'+265 213 456 789',
|
324
350
|
'+265 9123 456',
|
@@ -353,6 +379,11 @@ describe 'plausibility' do
|
|
353
379
|
end
|
354
380
|
it_is_correct_for 'Nicaragua', :samples => '+505 12 345 678'
|
355
381
|
it_is_correct_for 'Niger', :samples => '+227 1234 5678'
|
382
|
+
it_is_correct_for 'Nigeria', :samples => ['+234 807 059 1111',
|
383
|
+
'+234 811 234 5678',
|
384
|
+
'+234 64 830 00',
|
385
|
+
'+234 1 280 444',
|
386
|
+
'+234 85 123 456']
|
356
387
|
it_is_correct_for 'Niue', :samples => '+683 3791'
|
357
388
|
it_is_correct_for 'Oman', :samples => ['+968 24 423 123',
|
358
389
|
'+968 25 423 123']
|
@@ -385,6 +416,12 @@ describe 'plausibility' do
|
|
385
416
|
'+507 6 123 4567',
|
386
417
|
'+507 2 123 456']
|
387
418
|
it_is_correct_for 'Reunion / Mayotte (new)', :samples => '+262 295 276 964'
|
419
|
+
it_is_correct_for 'Rwanda', :samples => ['+250 72 1234567',
|
420
|
+
'+250 73 1234567',
|
421
|
+
'+250 78 1234567',
|
422
|
+
'+250 79 1234567',
|
423
|
+
'+250 25 1234567',
|
424
|
+
'+250 06 123456']
|
388
425
|
it_is_correct_for 'Saint Helena', :samples => '+290 5134'
|
389
426
|
it_is_correct_for 'Saint Pierre and Miquelon (Collectivité territoriale de la République française)', :samples => '+508 474 714'
|
390
427
|
it_is_correct_for 'Salvador (El)', :samples => [
|
@@ -413,8 +450,10 @@ describe 'plausibility' do
|
|
413
450
|
['+381 11 123 456', '+381 11 123 4567'],
|
414
451
|
'+381 72 123 456',
|
415
452
|
'+381 60 123',
|
416
|
-
'+381 60 123 4567',
|
453
|
+
['+381 60 123 4567', '+381 69 123 456'],
|
417
454
|
'+381 42 123 456',
|
455
|
+
'+381 677 123 456',
|
456
|
+
'+381 678 123 456',
|
418
457
|
'+381 9 123 4567',
|
419
458
|
'+381 60 123',
|
420
459
|
'+381 60 123 456 7890',
|
@@ -485,7 +524,10 @@ describe 'plausibility' do
|
|
485
524
|
it_is_correct_for 'Lybia', :samples => ['+218 205 123 45',
|
486
525
|
'+218 22 123 456',
|
487
526
|
'+218 21 1234 456',
|
488
|
-
'+218 91 1234 456'
|
527
|
+
'+218 91 1234 456',
|
528
|
+
'+218 92 1234 456',
|
529
|
+
'+218 94 1234 456',
|
530
|
+
'+218 95 1234 456']
|
489
531
|
it_is_correct_for 'Mongolia', :samples => ['+976 11 123 45',
|
490
532
|
['+976 121 12 34', '+976 121 12 345'],
|
491
533
|
'+976 70 123 456',
|
@@ -546,9 +588,12 @@ describe 'plausibility' do
|
|
546
588
|
'+967 58 1234']
|
547
589
|
it 'is correct for Zambia' do
|
548
590
|
Phony.plausible?('+260 211 123456').should be_truthy # Fixed
|
549
|
-
Phony.plausible?('+260
|
550
|
-
Phony.plausible?('+260
|
551
|
-
Phony.plausible?('+260
|
591
|
+
Phony.plausible?('+260 96 512 4567').should be_truthy # MTN Mobile
|
592
|
+
Phony.plausible?('+260 97 712 3456').should be_truthy # Airtel Mobile
|
593
|
+
Phony.plausible?('+260 95 512 4567').should be_truthy # Zamtel Mobile
|
594
|
+
Phony.plausible?('+260 96 512 456').should be_falsy # MTN Mobile (Too short)
|
595
|
+
Phony.plausible?('+260 97 812 345').should be_falsy # Airtel Mobile (Too short)
|
596
|
+
Phony.plausible?('+260 95 512 345').should be_falsy # Zamtel Mobile (Too short)
|
552
597
|
Phony.plausible?('+260 800 123 456').should be_truthy # Toll free
|
553
598
|
end
|
554
599
|
it_is_correct_for 'Zimbabwe', :samples => [['+263 2582 123 456', '+263 2582 123'],
|
@@ -563,6 +608,26 @@ describe 'plausibility' do
|
|
563
608
|
Phony.plausible?('+62 22 0000 0000').should be_truthy
|
564
609
|
Phony.plausible?('+62 22 000 000 000').should be_truthy
|
565
610
|
end
|
611
|
+
|
612
|
+
it 'is correct for Italy' do
|
613
|
+
Phony.plausible?('+39 0574 123').should be_falsy
|
614
|
+
Phony.plausible?('+39 0574 1234').should be_truthy
|
615
|
+
Phony.plausible?('+39 0574 12345').should be_falsy
|
616
|
+
|
617
|
+
Phony.plausible?('+39 085 541').should be_falsy
|
618
|
+
Phony.plausible?('+39 085 5410').should be_truthy
|
619
|
+
Phony.plausible?('+39 085 54105').should be_truthy
|
620
|
+
|
621
|
+
Phony.plausible?('+39 06 4991').should be_falsy
|
622
|
+
Phony.plausible?('+39 06 49911').should be_truthy
|
623
|
+
Phony.plausible?('+39 06 499112').should be_truthy
|
624
|
+
|
625
|
+
Phony.plausible?('+39 800 081631').should be_truthy
|
626
|
+
Phony.plausible?('+39 800 0816311').should be_falsy
|
627
|
+
|
628
|
+
Phony.plausible?('+39 803 08163').should be_falsy
|
629
|
+
Phony.plausible?('+39 803 081').should be_truthy
|
630
|
+
end
|
566
631
|
|
567
632
|
it 'is correct for Russia' do
|
568
633
|
Phony.plausible?('+7 3522 000 000').should be_truthy
|
@@ -600,6 +665,7 @@ describe 'plausibility' do
|
|
600
665
|
end
|
601
666
|
|
602
667
|
it 'is correct for Philippine' do
|
668
|
+
Phony.plausible?('+63 2 89889999').should be_truthy
|
603
669
|
Phony.plausible?('+63 976 1234567').should be_truthy # mobile phone with area code 9
|
604
670
|
Phony.plausible?('+63 876 1234567').should be_truthy # mobile phone with area code 8
|
605
671
|
end
|
@@ -5,7 +5,7 @@ require 'spec_helper'
|
|
5
5
|
describe 'country descriptions' do
|
6
6
|
|
7
7
|
def self.it_splits number, expected
|
8
|
-
it { Phony.split(number).
|
8
|
+
it { expect(Phony.split(number)).to eq expected }
|
9
9
|
end
|
10
10
|
|
11
11
|
describe 'regression' do
|
@@ -33,13 +33,13 @@ describe 'country descriptions' do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
describe 'Argentina' do
|
36
|
-
it_splits '541112345678', ['54', '11', '1234', '5678']
|
37
|
-
it_splits '542911234567', ['54', '291', '123', '4567']
|
38
|
-
it_splits '
|
39
|
-
it_splits '5491112345678', ['54', '911', '1234', '5678']
|
40
|
-
it_splits '5492201234567', ['54', '9220', '123', '4567']
|
41
|
-
it_splits '5492221123456', ['54', '92221', '12', '3456']
|
42
|
-
it_splits '548001234567', ['54', '800', '123', '4567']
|
36
|
+
it_splits '541112345678', ['54', '11', '1234', '5678'] # 2-digit area code / landline
|
37
|
+
it_splits '542911234567', ['54', '291', '123', '4567'] # 3-digit area code / landline
|
38
|
+
it_splits '542903123456', ['54', '2903', '12', '3456'] # 4-digit area code / landline
|
39
|
+
it_splits '5491112345678', ['54', '911', '1234', '5678'] # 2-digit area code / international mobile
|
40
|
+
it_splits '5492201234567', ['54', '9220', '123', '4567'] # 3-digit area code / international mobile
|
41
|
+
it_splits '5492221123456', ['54', '92221', '12', '3456'] # 4-digit area code / international mobile
|
42
|
+
it_splits '548001234567', ['54', '800', '123', '4567'] # Non-geographic number
|
43
43
|
end
|
44
44
|
|
45
45
|
describe 'Austria' do
|
@@ -103,8 +103,17 @@ describe 'country descriptions' do
|
|
103
103
|
it_splits '3295551914', ['32', '9', '555', '19', '14'] # Gent
|
104
104
|
it_splits '3245551414', ['32', '4', '555', '14', '14'] # Liège
|
105
105
|
it_splits '3216473200', ['32', '16', '47', '32', '00'] # Leuven
|
106
|
-
it_splits '
|
107
|
-
it_splits '
|
106
|
+
it_splits '32455123456', ['32', '455', '12', '34', '56'] # mobile (Voo)
|
107
|
+
it_splits '32456123456', ['32', '456', '12', '34', '56'] # mobile (MobileViking)
|
108
|
+
it_splits '32460123456', ['32', '460', '12', '34', '56'] # mobile (Proximus)
|
109
|
+
it_splits '32465123456', ['32', '465', '12', '34', '56'] # mobile (Lycamobile)
|
110
|
+
it_splits '32466123456', ['32', '466', '12', '34', '56'] # mobile (Vectone)
|
111
|
+
it_splits '32467123456', ['32', '467', '12', '34', '56'] # mobile (Telenet)
|
112
|
+
it_splits '32468123456', ['32', '468', '12', '34', '56'] # mobile (Telenet)
|
113
|
+
it_splits '32469123456', ['32', '469', '12', '34', '56'] # mobile ()
|
114
|
+
it_splits '32475123456', ['32', '475', '12', '34', '56'] # mobile (Proximus)
|
115
|
+
it_splits '32485123456', ['32', '485', '12', '34', '56'] # mobile (Telenet)
|
116
|
+
it_splits '32495123456', ['32', '495', '12', '34', '56'] # mobile (Orange)
|
108
117
|
it_splits '3270123123', ['32', '70', '123', '123'] # Bus Service?
|
109
118
|
it_splits '3278123123', ['32', '78', '123', '123'] # National rate service
|
110
119
|
it_splits '3290123123', ['32', '901', '23', '123'] # National rate service
|
@@ -214,9 +223,24 @@ describe 'country descriptions' do
|
|
214
223
|
describe 'China' do
|
215
224
|
it_splits '862112345678', ['86', '21', '1234', '5678'] # Shanghai
|
216
225
|
it_splits '8675582193447', ['86', '755', '8219', '3447'] # Shenzhen
|
226
|
+
it_splits '869511234567', ['86', '951', '123', '4567'] # Yinchuan
|
227
|
+
|
228
|
+
context 'mobile numbers' do
|
229
|
+
%w{
|
230
|
+
130 131 132 133 134 135 136 137 138 139
|
231
|
+
145 146 147 148 149
|
232
|
+
150 151 152 153 155 156 157 158 159
|
233
|
+
162 165 166 167
|
234
|
+
170 171 172 173 174 175 176 177 178
|
235
|
+
180 181 182 183 184 185 186 187 188 189
|
236
|
+
190 191 192 193 195 196 197 198 199
|
237
|
+
}.each do |prefix|
|
238
|
+
it_splits "86#{prefix}12345678", ['86', prefix, '1234', '5678']
|
239
|
+
end
|
240
|
+
end
|
217
241
|
end
|
218
242
|
describe 'Colombia' do
|
219
|
-
it_splits '5711234567', ['57', '1', '123', '4567']
|
243
|
+
it_splits '5711234567', ['57', '1', '123', '4567'] # Outdated.
|
220
244
|
it_splits '573101234567', ['57', '310', '123', '4567'] # mobile
|
221
245
|
end
|
222
246
|
describe 'Croatia' do
|
@@ -436,8 +460,9 @@ describe 'country descriptions' do
|
|
436
460
|
it_splits '3934869528123',['39', '348', '695', '2812', '3'] # Mobile (8-digit subscriber no - new)
|
437
461
|
it_splits '393357210488', ['39', '335', '721', '0488'] # Mobile
|
438
462
|
it_splits '393248644272', ['39', '324', '864', '4272'] # Mobile
|
439
|
-
it_splits '
|
440
|
-
it_splits '
|
463
|
+
it_splits '390612341', ['39', '06', '12341'] # Roma 5 digit
|
464
|
+
it_splits '3906123412', ['39', '06', '1234', '12'] # Roma 6 digit
|
465
|
+
it_splits '39061234123', ['39', '06', '1234', '123'] # Roma 7 digit
|
441
466
|
it_splits '390612341234', ['39', '06', '1234', '1234'] # Roma 8 digit
|
442
467
|
it_splits '3902888388', ['39', '02', '8883', '88'] # Milano 6 digit
|
443
468
|
it_splits '39028883888', ['39', '02', '8883', '888'] # Milano 7 digit
|
@@ -446,6 +471,7 @@ describe 'country descriptions' do
|
|
446
471
|
it_splits '3903123391', ['39', '031', '23391'] # Como
|
447
472
|
it_splits '390909709511', ['39', '090', '9709511'] # Barcellona
|
448
473
|
it_splits '390471811353', ['39', '0471', '811', '353'] # Bolzano
|
474
|
+
it_splits '3905745730', ['39', '0574', '5730'] # Prato
|
449
475
|
end
|
450
476
|
describe 'Japan' do
|
451
477
|
it_splits '81312345678', %w(81 3 1234 5678) # Tokyo
|
@@ -461,6 +487,8 @@ describe 'country descriptions' do
|
|
461
487
|
it_splits '817012345678', %w(81 70 1234 5678) # PHS
|
462
488
|
it_splits '818012345678', %w(81 80 1234 5678) # Cellular
|
463
489
|
it_splits '819012345678', %w(81 90 1234 5678) # Cellular
|
490
|
+
it_splits '810570123456', %w(81 570 123 456) # Navi-dial
|
491
|
+
it_splits '810180123456', %w(81 180 123 456) # Tele-gong/Tele-dome
|
464
492
|
end
|
465
493
|
describe 'Kenya' do
|
466
494
|
it_splits '254201234567', ['254', '20', '1234567'] # Nairobi
|
@@ -565,6 +593,10 @@ describe 'country descriptions' do
|
|
565
593
|
it_splits '31222123456', ['31', '222', '123', '456']
|
566
594
|
it_splits '3197012345678', ['31', '970', '1234', '5678'] # machine-to-machine
|
567
595
|
end
|
596
|
+
describe 'Norfolk Island' do
|
597
|
+
it_splits '672321234', ['672', '3', '21', '234'] # fixed
|
598
|
+
it_splits '672351234', ['672', '3', '51', '234'] # mobile
|
599
|
+
end
|
568
600
|
describe 'Norway' do
|
569
601
|
it_splits '4721234567', ['47',false,'21','23','45','67']
|
570
602
|
it_splits '4731234567', ['47',false,'31','23','45','67']
|
@@ -598,6 +630,7 @@ describe 'country descriptions' do
|
|
598
630
|
end
|
599
631
|
describe 'Philippines' do
|
600
632
|
it_splits '6321234567', ['63', '2', '1234567']
|
633
|
+
it_splits '63289889999', ['63', '2', '89889999']
|
601
634
|
it_splits '6321234567890', ['63', '2', '1234567890']
|
602
635
|
it_splits '632123456789012', ['63', '2', '123456789012']
|
603
636
|
it_splits '639121234567', ['63', '912', '1234567']
|
@@ -653,6 +686,7 @@ describe 'country descriptions' do
|
|
653
686
|
it_splits '250781234567', ['250', '78', '1234567'] # mobile
|
654
687
|
it_splits '250721234567', ['250', '72', '1234567'] # mobile
|
655
688
|
it_splits '250731234567', ['250', '73', '1234567'] # mobile
|
689
|
+
it_splits '250791234567', ['250', '79', '1234567'] # mobile
|
656
690
|
it_splits '250251234567', ['250', '25', '1234567'] # fixed
|
657
691
|
it_splits '25006123456', ['250', '06', '123456'] # fixed
|
658
692
|
end
|
@@ -735,6 +769,7 @@ describe 'country descriptions' do
|
|
735
769
|
describe 'Switzerland' do
|
736
770
|
it_splits '41443643532', ['41', '44', '364', '35', '32'] # Zurich (usually)
|
737
771
|
it_splits '41800334455', ['41', '800', '334', '455'] # Service number
|
772
|
+
it_splits '41860443643532', ['41', '860', '44', '364', '35', '32'] # Voicemail access
|
738
773
|
it_splits '41900123456', ['41', '900', '123', '456'] # Business Number
|
739
774
|
it_splits '41901123456', ['41', '901', '123', '456'] # Business Number Entertainment
|
740
775
|
it_splits '41906123456', ['41', '906', '123', '456'] # Business Number Adult Entertainment
|
@@ -823,9 +858,9 @@ describe 'country descriptions' do
|
|
823
858
|
end
|
824
859
|
describe 'Zambia' do
|
825
860
|
it_splits '260211123456', ['260', '211', '123456'] # Fixed
|
826
|
-
it_splits '260955123456', ['260', '
|
827
|
-
it_splits '260967123456', ['260', '
|
828
|
-
it_splits '260978123456', ['260', '
|
861
|
+
it_splits '260955123456', ['260', '95', '512', '3456'] # Mobile
|
862
|
+
it_splits '260967123456', ['260', '96', '712', '3456'] # Mobile
|
863
|
+
it_splits '260978123456', ['260', '97', '812', '3456'] # Mobile
|
829
864
|
it_splits '260800123456', ['260', '800', '123', '456'] # Toll free
|
830
865
|
end
|
831
866
|
describe 'New Zealand' do
|
@@ -840,7 +875,8 @@ describe 'country descriptions' do
|
|
840
875
|
it_splits '6737932744', %w(673 7 932 744)
|
841
876
|
end
|
842
877
|
describe 'Burkina Faso' do
|
843
|
-
it_splits '22667839323', ['226', false, '
|
878
|
+
it_splits '22667839323', ['226', false, '67', '83', '93', '23']
|
879
|
+
it_splits '22601234567', ['226', false, '01', '23', '45', '67'] # 0 not removed.
|
844
880
|
end
|
845
881
|
describe 'Burundi' do
|
846
882
|
it_splits '25712345678', ['257', false, '1234', '5678']
|
@@ -871,8 +907,8 @@ describe 'country descriptions' do
|
|
871
907
|
it_splits '50622345678', %w(506 2 234 5678)
|
872
908
|
end
|
873
909
|
describe "Côte d'Ivoire" do
|
874
|
-
it_splits '
|
875
|
-
it_splits '
|
910
|
+
it_splits '2250107335518', ['225', '01', '07', '33', '55', '18']
|
911
|
+
it_splits '2250237335518', ['225', '02', '37', '33', '55', '18']
|
876
912
|
end
|
877
913
|
describe 'Democratic Republic of Timor-Leste' do
|
878
914
|
it_splits '6701742945', ['670', false, '174', '2945']
|
@@ -935,6 +971,7 @@ describe 'country descriptions' do
|
|
935
971
|
end
|
936
972
|
describe 'Gabonese Republic' do
|
937
973
|
it_splits '2411834375', ['241', '1', '834', '375']
|
974
|
+
it_splits '24174012345', ['241', '74', '01', '23', '45']
|
938
975
|
end
|
939
976
|
describe 'Gambia' do
|
940
977
|
it_splits '2206683355', ['220', false, '668', '3355']
|
@@ -980,7 +1017,7 @@ describe 'country descriptions' do
|
|
980
1017
|
it_splits '96287901456', %w(962 8790 1456)
|
981
1018
|
end
|
982
1019
|
describe 'Kiribati (Republic of)' do
|
983
|
-
it_splits '
|
1020
|
+
it_splits '68634814527', ['686', false, '34814527']
|
984
1021
|
end
|
985
1022
|
describe "Democratic People's Republic of Korea" do
|
986
1023
|
it_splits '850212345', %w(850 2 123 45)
|
@@ -1022,11 +1059,14 @@ describe 'country descriptions' do
|
|
1022
1059
|
it_splits '21822123456', %w(218 22 123 456)
|
1023
1060
|
it_splits '218211234456', %w(218 21 1234 456)
|
1024
1061
|
it_splits '218911234456', %w(218 91 1234 456)
|
1062
|
+
it_splits '218941234456', %w(218 94 1234 456)
|
1063
|
+
it_splits '218951234456', %w(218 95 1234 456)
|
1025
1064
|
end
|
1026
1065
|
describe 'Madagascar' do
|
1027
|
-
it_splits '
|
1028
|
-
it_splits '
|
1029
|
-
it_splits '
|
1066
|
+
it_splits '261202254716', ['261', '20', *%w(22 547 16)]
|
1067
|
+
it_splits '261320254716', ['261', '32', *%w(02 547 16)]
|
1068
|
+
it_splits '261330254716', ['261', '33', *%w(02 547 16)]
|
1069
|
+
it_splits '261340254716', ['261', '34', *%w(02 547 16)]
|
1030
1070
|
end
|
1031
1071
|
describe 'Malawi' do
|
1032
1072
|
it_splits '2651725123', ['265', false, '1725', '123']
|
@@ -1103,6 +1143,8 @@ describe 'country descriptions' do
|
|
1103
1143
|
describe 'Nigeria' do
|
1104
1144
|
it_splits '23411231234', %w(234 1 123 1234) # Lagos
|
1105
1145
|
|
1146
|
+
it_splits '23445123456', %w(234 45 123 456) # Ogoja
|
1147
|
+
|
1106
1148
|
# mobile numbers
|
1107
1149
|
it_splits '2347007661234', %w(234 700 766 1234)
|
1108
1150
|
it_splits '2347017661234', %w(234 701 766 1234)
|
@@ -1137,6 +1179,17 @@ describe 'country descriptions' do
|
|
1137
1179
|
it_splits '2349087661234', %w(234 908 766 1234)
|
1138
1180
|
it_splits '2349097661234', %w(234 909 766 1234)
|
1139
1181
|
|
1182
|
+
it_splits '2349107661234', %w(234 910 766 1234)
|
1183
|
+
it_splits '2349117661234', %w(234 911 766 1234)
|
1184
|
+
it_splits '2349127661234', %w(234 912 766 1234)
|
1185
|
+
it_splits '2349137661234', %w(234 913 766 1234)
|
1186
|
+
it_splits '2349147661234', %w(234 914 766 1234)
|
1187
|
+
it_splits '2349157661234', %w(234 915 766 1234)
|
1188
|
+
it_splits '2349167661234', %w(234 916 766 1234)
|
1189
|
+
it_splits '2349177661234', %w(234 917 766 1234)
|
1190
|
+
it_splits '2349187661234', %w(234 918 766 1234)
|
1191
|
+
it_splits '2349197661234', %w(234 919 766 1234)
|
1192
|
+
|
1140
1193
|
it_splits '2348107661234', %w(234 810 766 1234)
|
1141
1194
|
it_splits '2348117661234', %w(234 811 766 1234)
|
1142
1195
|
it_splits '2348127661234', %w(234 812 766 1234)
|
@@ -1188,6 +1241,7 @@ describe 'country descriptions' do
|
|
1188
1241
|
describe 'Samoa (Independent State of)' do
|
1189
1242
|
it_splits '685800123', ['685', false, '800', '123']
|
1190
1243
|
it_splits '68561123', ['685', false, '61', '123']
|
1244
|
+
it_splits '6857112345', ['685', false, '711', '2345']
|
1191
1245
|
it_splits '6857212345', ['685', false, '721', '2345']
|
1192
1246
|
it_splits '685830123', ['685', false, '830', '123']
|
1193
1247
|
it_splits '685601234', ['685', false, '601', '234']
|
@@ -1276,6 +1330,7 @@ describe 'country descriptions' do
|
|
1276
1330
|
it_splits '88633123456', %w(886 3 312 3456)
|
1277
1331
|
it_splits '88637123456', %w(886 37 12 3456)
|
1278
1332
|
it_splits '88682712345', %w(886 82 71 2345)
|
1333
|
+
it_splits '886801123123', %w(886 801 123 123)
|
1279
1334
|
it_splits '88689712345', %w(886 89 71 2345)
|
1280
1335
|
it_splits '88682672345', %w(886 826 7 2345)
|
1281
1336
|
it_splits '88683672345', %w(886 836 7 2345)
|
@@ -1386,6 +1441,14 @@ describe 'country descriptions' do
|
|
1386
1441
|
it_splits number, ['263', prefix, '234', '5678']
|
1387
1442
|
end
|
1388
1443
|
end
|
1444
|
+
|
1445
|
+
describe 'Universal International Freephone' do
|
1446
|
+
it_splits '80012345678', ['800', false, '12345678']
|
1447
|
+
end
|
1448
|
+
|
1449
|
+
describe 'Shared-Cost Service' do
|
1450
|
+
it_splits '80812345678', ['808', false, '12345678']
|
1451
|
+
end
|
1389
1452
|
end
|
1390
1453
|
|
1391
1454
|
end
|