phony 2.17.0 → 2.20.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.textile +34 -6
- data/lib/phony/config.rb +91 -0
- data/lib/phony/countries/argentina.rb +355 -0
- data/lib/phony/countries/austria.rb +4 -2
- data/lib/phony/countries/bangladesh.rb +2 -0
- data/lib/phony/countries/belarus.rb +2 -0
- data/lib/phony/countries/brazil.rb +4 -2
- data/lib/phony/countries/cambodia.rb +3 -5
- data/lib/phony/countries/china.rb +7 -2
- data/lib/phony/countries/croatia.rb +2 -0
- data/lib/phony/countries/georgia.rb +2 -0
- data/lib/phony/countries/germany.rb +5 -2
- data/lib/phony/countries/guinea.rb +8 -5
- data/lib/phony/countries/india.rb +2 -0
- data/lib/phony/countries/indonesia.rb +2 -0
- data/lib/phony/countries/ireland.rb +27 -23
- data/lib/phony/countries/italy.rb +41 -18
- data/lib/phony/countries/japan.rb +60 -8
- data/lib/phony/countries/kyrgyzstan.rb +2 -0
- data/lib/phony/countries/latvia.rb +2 -0
- data/lib/phony/countries/libya.rb +3 -1
- data/lib/phony/countries/malaysia.rb +2 -0
- data/lib/phony/countries/moldova.rb +2 -0
- data/lib/phony/countries/montenegro.rb +2 -0
- data/lib/phony/countries/myanmar.rb +2 -0
- data/lib/phony/countries/namibia.rb +2 -0
- data/lib/phony/countries/nepal.rb +2 -0
- data/lib/phony/countries/netherlands.rb +2 -0
- data/lib/phony/countries/pakistan.rb +2 -0
- data/lib/phony/countries/paraguay.rb +2 -0
- data/lib/phony/countries/russia_kazakhstan_abkhasia_south_ossetia.rb +2 -0
- data/lib/phony/countries/saudi_arabia.rb +2 -0
- data/lib/phony/countries/serbia.rb +7 -1
- data/lib/phony/countries/somalia.rb +2 -0
- data/lib/phony/countries/south_korea.rb +7 -2
- data/lib/phony/countries/sweden.rb +2 -0
- data/lib/phony/countries/taiwan.rb +3 -0
- data/lib/phony/countries/tajikistan.rb +2 -0
- data/lib/phony/countries/turkmenistan.rb +2 -0
- data/lib/phony/countries/ukraine.rb +2 -0
- data/lib/phony/countries/united_kingdom.rb +5 -2
- data/lib/phony/countries/uruguay.rb +2 -0
- data/lib/phony/countries/vietnam.rb +7 -1
- data/lib/phony/countries/zimbabwe.rb +2 -0
- data/lib/phony/countries.rb +108 -65
- data/lib/phony/country.rb +11 -3
- data/lib/phony/country_codes.rb +16 -3
- data/lib/phony/dsl.rb +5 -3
- 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 +62 -57
- data/spec/functional/config_spec.rb +44 -0
- data/spec/functional/plausibility_spec.rb +104 -19
- data/spec/lib/phony/countries_spec.rb +107 -35
- 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 +7 -3
- data/spec/lib/phony/local_splitters/regex_spec.rb +19 -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 +23 -18
@@ -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
|
@@ -138,9 +147,8 @@ describe 'country descriptions' do
|
|
138
147
|
end
|
139
148
|
|
140
149
|
describe 'Brazil' do
|
141
|
-
it_splits '
|
150
|
+
it_splits '551122341234', ['55', '11', '2234', '1234']
|
142
151
|
it_splits '5511981231234', ['55', '11', '98123', '1234'] # São Paulo's 9 digits mobile
|
143
|
-
it_splits '552181231234', ['55', '21', '8123', '1234']
|
144
152
|
it_splits '5521981231234', ['55', '21', '98123', '1234'] # Rio de Janeiro's 9 digits mobile
|
145
153
|
it_splits '551931311234', ['55', '19', '3131', '1234']
|
146
154
|
it_splits '5531991311234', ['55', '31', '99131', '1234'] # Belo Horizonte's 9th digit
|
@@ -148,6 +156,7 @@ describe 'country descriptions' do
|
|
148
156
|
it_splits '5579991311234', ['55', '79', '99131', '1234'] # Sergipe's 9th digit
|
149
157
|
it_splits '5547991311234', ['55', '47', '99131', '1234'] # Santa Catarina's 9th digit
|
150
158
|
it_splits '5541991311234', ['55', '41', '99131', '1234'] # Parana's 9th digit
|
159
|
+
it_splits '556734212121', ['55', '67', '3421', '2121']
|
151
160
|
|
152
161
|
context 'mobile numbers' do
|
153
162
|
%w{
|
@@ -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
|
@@ -291,7 +315,7 @@ describe 'country descriptions' do
|
|
291
315
|
it_splits '49800222340010', ['49', '800', '222', '340010'] # Service number
|
292
316
|
|
293
317
|
it_splits '4915111231234', ['49', '151', '1123', '1234'] # Mobile number
|
294
|
-
it_splits '4915771231234', ['49', '
|
318
|
+
it_splits '4915771231234', ['49', '1577', '123', '1234'] # Mobile number
|
295
319
|
it_splits '491601234567', ['49', '160', '1234', '567'] # Mobile number
|
296
320
|
it_splits '4916312345678', ['49', '163', '1234', '5678'] # Mobile number
|
297
321
|
it_splits '4915211231234', ['49', '1521', '123', '1234'] # Mobile number
|
@@ -329,7 +353,8 @@ describe 'country descriptions' do
|
|
329
353
|
end
|
330
354
|
|
331
355
|
describe 'Hong Kong' do
|
332
|
-
it_splits '85212341234', ['852', false, '1234', '1234']
|
356
|
+
it_splits '85212341234', ['852', false, '1234', '1234'] #Other Numbers
|
357
|
+
it_splits '852800121234', ['852', '800', '12', '1234'] #Toll Free
|
333
358
|
end
|
334
359
|
|
335
360
|
describe 'Hungary' do
|
@@ -400,6 +425,7 @@ describe 'country descriptions' do
|
|
400
425
|
it_splits '35311234567', ['353', '1', '123', '4567'] # Dublin, 7 digit subscriber #
|
401
426
|
it_splits '353539233333', ['353', '53', '923', '3333'] # Wexford, 7 digit subscriber
|
402
427
|
it_splits '3532212345', ['353', '22', '12345'] # Mallow, 5 digit subscriber #
|
428
|
+
it_splits '353441234567', ['353', '44', '123', '4567'] # Mullingar, Castlepollard, Tyrellspass 7 digit subscriber #
|
403
429
|
it_splits '35345123456', ['353', '45', '123456'] # Naas, 6 digit subscriber #
|
404
430
|
it_splits '353801234567', ['353', '80', '123', '4567'] # Mobile
|
405
431
|
it_splits '353761234567', ['353', '76', '123', '4567'] # VoIP
|
@@ -408,14 +434,16 @@ describe 'country descriptions' do
|
|
408
434
|
end
|
409
435
|
|
410
436
|
describe 'Israel (972)' do
|
411
|
-
it_splits '972100', ['972', '1', '00']
|
412
|
-
it_splits '97221231234', ['972', '2', '123', '1234']
|
413
|
-
it_splits '97282411234', ['972', '8', '241', '1234']
|
414
|
-
it_splits '97291231234', ['972', '9', '123', '1234']
|
415
|
-
it_splits '972501231234', ['972', '50', '123', '1234']
|
416
|
-
it_splits '972591231234', ['972', '59', '123', '1234']
|
417
|
-
it_splits '972771231234', ['972', '77', '123', '1234']
|
437
|
+
it_splits '972100', ['972', '1', '00'] # Police
|
438
|
+
it_splits '97221231234', ['972', '2', '123', '1234'] # Jerusalem Area
|
439
|
+
it_splits '97282411234', ['972', '8', '241', '1234'] # Gaza Strip (Palestine)
|
440
|
+
it_splits '97291231234', ['972', '9', '123', '1234'] # Sharon Area
|
441
|
+
it_splits '972501231234', ['972', '50', '123', '1234'] # Mobile (Pelephone)
|
442
|
+
it_splits '972591231234', ['972', '59', '123', '1234'] # Mobile Jawwal (Palestine)
|
443
|
+
it_splits '972771231234', ['972', '77', '123', '1234'] # Cable Phone Services
|
418
444
|
it_splits '9721700123123', ['972', '1', '700', '123', '123'] # Cable Phone Services
|
445
|
+
it_splits '972511234567', ['972', '51', '123', '4567'] # Mobile (We4G)
|
446
|
+
it_splits '972791111111', ['972', '79', '111', '1111'] # Landline (Hallo, Cellact, Telzar)
|
419
447
|
end
|
420
448
|
describe 'Israel (970)' do
|
421
449
|
it_splits '97021231234', ['970', '2', '123', '1234'] # Jerusalem Area
|
@@ -432,8 +460,9 @@ describe 'country descriptions' do
|
|
432
460
|
it_splits '3934869528123',['39', '348', '695', '2812', '3'] # Mobile (8-digit subscriber no - new)
|
433
461
|
it_splits '393357210488', ['39', '335', '721', '0488'] # Mobile
|
434
462
|
it_splits '393248644272', ['39', '324', '864', '4272'] # Mobile
|
435
|
-
it_splits '
|
436
|
-
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
|
437
466
|
it_splits '390612341234', ['39', '06', '1234', '1234'] # Roma 8 digit
|
438
467
|
it_splits '3902888388', ['39', '02', '8883', '88'] # Milano 6 digit
|
439
468
|
it_splits '39028883888', ['39', '02', '8883', '888'] # Milano 7 digit
|
@@ -442,6 +471,7 @@ describe 'country descriptions' do
|
|
442
471
|
it_splits '3903123391', ['39', '031', '23391'] # Como
|
443
472
|
it_splits '390909709511', ['39', '090', '9709511'] # Barcellona
|
444
473
|
it_splits '390471811353', ['39', '0471', '811', '353'] # Bolzano
|
474
|
+
it_splits '3905745730', ['39', '0574', '5730'] # Prato
|
445
475
|
end
|
446
476
|
describe 'Japan' do
|
447
477
|
it_splits '81312345678', %w(81 3 1234 5678) # Tokyo
|
@@ -457,6 +487,8 @@ describe 'country descriptions' do
|
|
457
487
|
it_splits '817012345678', %w(81 70 1234 5678) # PHS
|
458
488
|
it_splits '818012345678', %w(81 80 1234 5678) # Cellular
|
459
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
|
460
492
|
end
|
461
493
|
describe 'Kenya' do
|
462
494
|
it_splits '254201234567', ['254', '20', '1234567'] # Nairobi
|
@@ -496,6 +528,8 @@ describe 'country descriptions' do
|
|
496
528
|
it_splits '352545258', ['352', '54', '52', '58']
|
497
529
|
it_splits '352818181', ['352', '81', '81', '81']
|
498
530
|
it_splits '3523572141', ['352', '35', '72', '14', '1']
|
531
|
+
it_splits '3522634731', ['352', '26', '34', '73', '1']
|
532
|
+
it_splits '352264412701', ['352', '26', '44', '12', '701']
|
499
533
|
end
|
500
534
|
describe 'Macedonia' do
|
501
535
|
it_splits '38921234567', ['389', '2', '123', '4567'] # Skopje
|
@@ -561,6 +595,10 @@ describe 'country descriptions' do
|
|
561
595
|
it_splits '31222123456', ['31', '222', '123', '456']
|
562
596
|
it_splits '3197012345678', ['31', '970', '1234', '5678'] # machine-to-machine
|
563
597
|
end
|
598
|
+
describe 'Norfolk Island' do
|
599
|
+
it_splits '672321234', ['672', '3', '21', '234'] # fixed
|
600
|
+
it_splits '672351234', ['672', '3', '51', '234'] # mobile
|
601
|
+
end
|
564
602
|
describe 'Norway' do
|
565
603
|
it_splits '4721234567', ['47',false,'21','23','45','67']
|
566
604
|
it_splits '4731234567', ['47',false,'31','23','45','67']
|
@@ -594,6 +632,7 @@ describe 'country descriptions' do
|
|
594
632
|
end
|
595
633
|
describe 'Philippines' do
|
596
634
|
it_splits '6321234567', ['63', '2', '1234567']
|
635
|
+
it_splits '63289889999', ['63', '2', '89889999']
|
597
636
|
it_splits '6321234567890', ['63', '2', '1234567890']
|
598
637
|
it_splits '632123456789012', ['63', '2', '123456789012']
|
599
638
|
it_splits '639121234567', ['63', '912', '1234567']
|
@@ -649,6 +688,7 @@ describe 'country descriptions' do
|
|
649
688
|
it_splits '250781234567', ['250', '78', '1234567'] # mobile
|
650
689
|
it_splits '250721234567', ['250', '72', '1234567'] # mobile
|
651
690
|
it_splits '250731234567', ['250', '73', '1234567'] # mobile
|
691
|
+
it_splits '250791234567', ['250', '79', '1234567'] # mobile
|
652
692
|
it_splits '250251234567', ['250', '25', '1234567'] # fixed
|
653
693
|
it_splits '25006123456', ['250', '06', '123456'] # fixed
|
654
694
|
end
|
@@ -731,6 +771,7 @@ describe 'country descriptions' do
|
|
731
771
|
describe 'Switzerland' do
|
732
772
|
it_splits '41443643532', ['41', '44', '364', '35', '32'] # Zurich (usually)
|
733
773
|
it_splits '41800334455', ['41', '800', '334', '455'] # Service number
|
774
|
+
it_splits '41860443643532', ['41', '860', '44', '364', '35', '32'] # Voicemail access
|
734
775
|
it_splits '41900123456', ['41', '900', '123', '456'] # Business Number
|
735
776
|
it_splits '41901123456', ['41', '901', '123', '456'] # Business Number Entertainment
|
736
777
|
it_splits '41906123456', ['41', '906', '123', '456'] # Business Number Adult Entertainment
|
@@ -816,12 +857,14 @@ describe 'country descriptions' do
|
|
816
857
|
it_splits '842841234567', ['84', '28', '4123', '4567'] # Ho Chi Minh City
|
817
858
|
it_splits '84341234567', ['84', '34', '1234567'] # Viettel
|
818
859
|
it_splits '84841234567', ['84', '84', '1234567'] # Vinaphone
|
860
|
+
it_splits '8419001212', ['84', '1900', '1212'] # Vinaphone
|
861
|
+
it_splits '841900541234', ['84', '1900', '541234'] # Vinaphone
|
819
862
|
end
|
820
863
|
describe 'Zambia' do
|
821
864
|
it_splits '260211123456', ['260', '211', '123456'] # Fixed
|
822
|
-
it_splits '260955123456', ['260', '
|
823
|
-
it_splits '260967123456', ['260', '
|
824
|
-
it_splits '260978123456', ['260', '
|
865
|
+
it_splits '260955123456', ['260', '95', '512', '3456'] # Mobile
|
866
|
+
it_splits '260967123456', ['260', '96', '712', '3456'] # Mobile
|
867
|
+
it_splits '260978123456', ['260', '97', '812', '3456'] # Mobile
|
825
868
|
it_splits '260800123456', ['260', '800', '123', '456'] # Toll free
|
826
869
|
end
|
827
870
|
describe 'New Zealand' do
|
@@ -836,7 +879,8 @@ describe 'country descriptions' do
|
|
836
879
|
it_splits '6737932744', %w(673 7 932 744)
|
837
880
|
end
|
838
881
|
describe 'Burkina Faso' do
|
839
|
-
it_splits '22667839323', ['226', false, '
|
882
|
+
it_splits '22667839323', ['226', false, '67', '83', '93', '23']
|
883
|
+
it_splits '22601234567', ['226', false, '01', '23', '45', '67'] # 0 not removed.
|
840
884
|
end
|
841
885
|
describe 'Burundi' do
|
842
886
|
it_splits '25712345678', ['257', false, '1234', '5678']
|
@@ -867,8 +911,8 @@ describe 'country descriptions' do
|
|
867
911
|
it_splits '50622345678', %w(506 2 234 5678)
|
868
912
|
end
|
869
913
|
describe "Côte d'Ivoire" do
|
870
|
-
it_splits '
|
871
|
-
it_splits '
|
914
|
+
it_splits '2250107335518', ['225', '01', '07', '33', '55', '18']
|
915
|
+
it_splits '2250237335518', ['225', '02', '37', '33', '55', '18']
|
872
916
|
end
|
873
917
|
describe 'Democratic Republic of Timor-Leste' do
|
874
918
|
it_splits '6701742945', ['670', false, '174', '2945']
|
@@ -931,6 +975,7 @@ describe 'country descriptions' do
|
|
931
975
|
end
|
932
976
|
describe 'Gabonese Republic' do
|
933
977
|
it_splits '2411834375', ['241', '1', '834', '375']
|
978
|
+
it_splits '24174012345', ['241', '74', '01', '23', '45']
|
934
979
|
end
|
935
980
|
describe 'Gambia' do
|
936
981
|
it_splits '2206683355', ['220', false, '668', '3355']
|
@@ -976,7 +1021,7 @@ describe 'country descriptions' do
|
|
976
1021
|
it_splits '96287901456', %w(962 8790 1456)
|
977
1022
|
end
|
978
1023
|
describe 'Kiribati (Republic of)' do
|
979
|
-
it_splits '
|
1024
|
+
it_splits '68634814527', ['686', false, '34814527']
|
980
1025
|
end
|
981
1026
|
describe "Democratic People's Republic of Korea" do
|
982
1027
|
it_splits '850212345', %w(850 2 123 45)
|
@@ -1018,11 +1063,14 @@ describe 'country descriptions' do
|
|
1018
1063
|
it_splits '21822123456', %w(218 22 123 456)
|
1019
1064
|
it_splits '218211234456', %w(218 21 1234 456)
|
1020
1065
|
it_splits '218911234456', %w(218 91 1234 456)
|
1066
|
+
it_splits '218941234456', %w(218 94 1234 456)
|
1067
|
+
it_splits '218951234456', %w(218 95 1234 456)
|
1021
1068
|
end
|
1022
1069
|
describe 'Madagascar' do
|
1023
|
-
it_splits '
|
1024
|
-
it_splits '
|
1025
|
-
it_splits '
|
1070
|
+
it_splits '261202254716', ['261', '20', *%w(22 547 16)]
|
1071
|
+
it_splits '261320254716', ['261', '32', *%w(02 547 16)]
|
1072
|
+
it_splits '261330254716', ['261', '33', *%w(02 547 16)]
|
1073
|
+
it_splits '261340254716', ['261', '34', *%w(02 547 16)]
|
1026
1074
|
end
|
1027
1075
|
describe 'Malawi' do
|
1028
1076
|
it_splits '2651725123', ['265', false, '1725', '123']
|
@@ -1046,7 +1094,8 @@ describe 'country descriptions' do
|
|
1046
1094
|
it_splits '22212345678', ['222', false, '1234', '5678']
|
1047
1095
|
end
|
1048
1096
|
describe 'Mauritius' do
|
1049
|
-
it_splits '23059518919', ['230', false, '
|
1097
|
+
it_splits '23059518919', ['230', false, '5', '951', '8919']
|
1098
|
+
it_splits '2302600070', ['230', false, '260', '0070']
|
1050
1099
|
end
|
1051
1100
|
describe 'Micronesia (Federated States of)' do
|
1052
1101
|
it_splits '6911991754', ['691', false, '199', '1754']
|
@@ -1099,6 +1148,8 @@ describe 'country descriptions' do
|
|
1099
1148
|
describe 'Nigeria' do
|
1100
1149
|
it_splits '23411231234', %w(234 1 123 1234) # Lagos
|
1101
1150
|
|
1151
|
+
it_splits '23445123456', %w(234 45 123 456) # Ogoja
|
1152
|
+
|
1102
1153
|
# mobile numbers
|
1103
1154
|
it_splits '2347007661234', %w(234 700 766 1234)
|
1104
1155
|
it_splits '2347017661234', %w(234 701 766 1234)
|
@@ -1133,6 +1184,17 @@ describe 'country descriptions' do
|
|
1133
1184
|
it_splits '2349087661234', %w(234 908 766 1234)
|
1134
1185
|
it_splits '2349097661234', %w(234 909 766 1234)
|
1135
1186
|
|
1187
|
+
it_splits '2349107661234', %w(234 910 766 1234)
|
1188
|
+
it_splits '2349117661234', %w(234 911 766 1234)
|
1189
|
+
it_splits '2349127661234', %w(234 912 766 1234)
|
1190
|
+
it_splits '2349137661234', %w(234 913 766 1234)
|
1191
|
+
it_splits '2349147661234', %w(234 914 766 1234)
|
1192
|
+
it_splits '2349157661234', %w(234 915 766 1234)
|
1193
|
+
it_splits '2349167661234', %w(234 916 766 1234)
|
1194
|
+
it_splits '2349177661234', %w(234 917 766 1234)
|
1195
|
+
it_splits '2349187661234', %w(234 918 766 1234)
|
1196
|
+
it_splits '2349197661234', %w(234 919 766 1234)
|
1197
|
+
|
1136
1198
|
it_splits '2348107661234', %w(234 810 766 1234)
|
1137
1199
|
it_splits '2348117661234', %w(234 811 766 1234)
|
1138
1200
|
it_splits '2348127661234', %w(234 812 766 1234)
|
@@ -1184,6 +1246,7 @@ describe 'country descriptions' do
|
|
1184
1246
|
describe 'Samoa (Independent State of)' do
|
1185
1247
|
it_splits '685800123', ['685', false, '800', '123']
|
1186
1248
|
it_splits '68561123', ['685', false, '61', '123']
|
1249
|
+
it_splits '6857112345', ['685', false, '711', '2345']
|
1187
1250
|
it_splits '6857212345', ['685', false, '721', '2345']
|
1188
1251
|
it_splits '685830123', ['685', false, '830', '123']
|
1189
1252
|
it_splits '685601234', ['685', false, '601', '234']
|
@@ -1272,6 +1335,7 @@ describe 'country descriptions' do
|
|
1272
1335
|
it_splits '88633123456', %w(886 3 312 3456)
|
1273
1336
|
it_splits '88637123456', %w(886 37 12 3456)
|
1274
1337
|
it_splits '88682712345', %w(886 82 71 2345)
|
1338
|
+
it_splits '886801123123', %w(886 801 123 123)
|
1275
1339
|
it_splits '88689712345', %w(886 89 71 2345)
|
1276
1340
|
it_splits '88682672345', %w(886 826 7 2345)
|
1277
1341
|
it_splits '88683672345', %w(886 836 7 2345)
|
@@ -1382,6 +1446,14 @@ describe 'country descriptions' do
|
|
1382
1446
|
it_splits number, ['263', prefix, '234', '5678']
|
1383
1447
|
end
|
1384
1448
|
end
|
1449
|
+
|
1450
|
+
describe 'Universal International Freephone' do
|
1451
|
+
it_splits '80012345678', ['800', false, '12345678']
|
1452
|
+
end
|
1453
|
+
|
1454
|
+
describe 'Shared-Cost Service' do
|
1455
|
+
it_splits '80812345678', ['808', false, '12345678']
|
1456
|
+
end
|
1385
1457
|
end
|
1386
1458
|
|
1387
1459
|
end
|