phony 2.14.0 → 2.14.1

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: ad23d7833af7d5c22a7a2157ac509e762c16ad39
4
- data.tar.gz: 0d2aab1c49bdac649ce7d2c0a93e4acf2234f714
3
+ metadata.gz: 6f176fe5c0972820c2a7b6c68a28134df005a268
4
+ data.tar.gz: 59bda0f14c11a48cc4f11798fc9d74cb63c21fe8
5
5
  SHA512:
6
- metadata.gz: 089b667c5e5651ce2b8b1ae611cd74fa84cd32b71207a1246aa143c96c78ed50e29799e9cda94def9dee22027c68a0c06753fdaef2e00a531d5aca9c251c24ac
7
- data.tar.gz: cc36ddfa8d3afef335858bcf700fc726cfcc2fcc8d87db4327356f09eb09b54b9df595a84e8cdf971fc7935e6659da417303fd3399fdb9e71abe9d520d6d4813
6
+ metadata.gz: e6e8c2d1de18eed818f6f039ef2c26e554aa1e4e71a8665bead03d2ef99a263a2540eb0fac72e4bbd0ebe00a146e5dd326237745e99ff74380fa5e9fab901b2a
7
+ data.tar.gz: 201013ab59ddfc703d2da4044066324c87d1befe6dca48fbecdbc8d5952ac7ae64765bff59c630109f19647a7cc039eb717e74c5b326fd2a2fddcd466cc6c5fc
data/README.textile CHANGED
@@ -5,199 +5,74 @@
5
5
 
6
6
  h1. Phony
7
7
 
8
- Warning: International numbers only, such as @+61 412 345 678@!
8
+ Disclaimer: Phony works with international numbers only, such as @+61 412 345 678@!
9
9
 
10
- The (admittedly crazy) goal of this Gem is to be able to format/split all phone numbers in the world.
10
+ The (admittedly crazy) goal of this Gem is to be able to normalize/format/split all phone numbers in the world.
11
11
 
12
- Used in: "airbnb.com":http://airbnb.com, "restorm.com":http://restorm.com, "socialcam.com":http://socialcam.com, "zendesk.com":http://www.zendesk.com/ (and many, many others).
13
-
14
- There's also a Rails wrapper: https://github.com/joost/phony_rails.
12
+ Used in: "airbnb.com":http://airbnb.com, "socialcam.com":http://socialcam.com, "zendesk.com":http://www.zendesk.com/ (and many, many others).
15
13
 
16
14
  h2. Description
17
15
 
18
- This gem normalizes, formats and splits *E164 phone numbers*. A valid E164 phone number *must* include a country code.
16
+ This gem normalizes, formats and splits "*E164 phone numbers*":http://en.wikipedia.org/wiki/E.164. A valid E164 phone number *must* include a country code.
19
17
 
20
18
  E164 numbers are international numbers with a country dial prefix, usually an area code and a subscriber number. For example, the Austalian number number @+61 412 345 678@ can be broken down into the following components:
21
- * a country code of @61@
22
- * a mobile number denoted by the @4@ (specific to Australia)
23
- * a subscriber number of @12 345 678@
24
-
25
- Learn more about E164 numbers "here":http://en.wikipedia.org/wiki/E.164.
19
+ * Country Code (CC): a country code of @61@
20
+ * National Destination Code (NDC): a mobile number denoted by the @4@ (specific to Australia)
21
+ * Local Number Part: a subscriber number of @12 345 678@
26
22
 
27
- Currently handles Abhas, Afghan, Algerian, Argentinan, Austrian, Australian, Azerbaijani, Belgian, Brazilian, Cambodian, Chilean, Chinese, Croatian, Cuban, Cypriot, Czech, Danish, Dutch, Egyptian, El Salvadorian, Estonian, French, German, Ghanan, Gibraltar, Greek, Haiti, Hong Kong, Hungarian, Indian, Iran, Irish, Israel, Italian, Kazakh, Liberian, Lithuanian, Luxembourgian, Malaysian, Malta, Mexican, Monaco, Morocco, New Zealand, Nigerian, Norwegian, Peruvian, Polish, Romanian, Russian, Rwandan, Seychelles, Singapore, Slovakian, South African, South Korean, South Osetian, Spanish, Sri Lankan, Sudan, Swedish, Swiss, Thailand, Tunisian, Turkish, Liechtenstein, UK, US, Venezuelan, Vietnamese, and Zambian numbers.
23
+ It currently handles the countries listed at the end of this README.
28
24
 
29
- And to some extent, all others. Just try if it works for you.
30
-
31
- If it doesn't, please "enter an issue":http://github.com/floere/phony/issues.
25
+ If it doesn't work, please "enter an issue":http://github.com/floere/phony/issues or better, fork and "send a pull request":http://github.com/floere/phony/pulls.
32
26
 
33
27
  h2. Installation
34
28
 
35
- Using with Rails? Check out: https://github.com/joost/phony_rails.
36
-
37
- With Bundler:
38
- Append @gem 'phony'@ to your @Gemfile@ and @bundle install@ it.
39
-
40
- Without Bundler:
41
- Run @gem install phony@ from your command line.
42
-
43
- h2(#usage). Usage
44
-
45
- h3(#plausibility). Plausibility
46
-
47
- "Plausible" means "seems reasonable or probable", not implying 100% correctness on a @true@, but implying 100% correctness on a @false@ return value. So if this returns @true@, it might still be not a plausible number. If it returns @false@, it is definitely not an E164 conform number.
48
-
49
- Use this method in combination with @normalize@ for saving it into the database. Also see https://github.com/floere/phony/issues/35 for a discussion on the topic.
50
-
51
- Note that you can add constraints to the plausibility check like the country code, @cc@, and the national destination code, @ndc@. Use the options to further limit the plausibility range. For example, only allow a small number of countries.
52
-
53
- @Phony.plausible?('0000000').should be_false@
54
-
55
- @Phony.plausible?('hello').should be_false@
56
-
57
- Always use it with a country code, as Phony needs it to know what country to check:
58
-
59
- @Phony.plausible?('+41 44 111 22 33').should be_true@
60
-
61
- @Phony.plausible?('+41 44 111 22 33', cc: '41').should be_true@
62
-
63
- @Phony.plausible?('+41 44 111 22 33', ndc: '44').should be_true@
64
-
65
- @Phony.plausible?('+41 44 111 22 33', cc: '1').should be_false@
66
-
67
- @Phony.plausible?('+41 44 111 22 33', ndc: '43').should be_false@
68
-
69
- @Phony.plausible?('+41 44 111 22 33', cc: '41', ndc: '44').should be_true@
70
-
71
- @Phony.plausible?('+41 44 111 22 33', cc: /4(0|2)/, ndc: /4(4|5)/).should be_false@
72
-
73
- @Phony.plausible?('+41 44 111 22 33', cc: /4(0|1)/, ndc: /4(4|5)/).should be_true@
74
-
75
- h3(#normalizing). Normalizing
76
-
77
- This will often raise an error if you try normalizing a non E164-izable number (a number that does not contain enough information to be normalized into an E164 conform number). Use @Phony.plausible?@ for checking if it can be normalized first.
78
-
79
- Example:
80
-
81
- @Phony.normalize('364 35 33')@ No. Wrong. Nada.
82
-
83
- Always use it with a country code, as Phony needs it to know what country to normalize for:
84
-
85
- @Phony.normalize('41443643533').should == '41443643533'@
86
-
87
- @Phony.normalize('+41 44 364 35 33').should == '41443643533'@
88
-
89
- @Phony.normalize('+41 44 364 35 33').should == '41443643533'@
90
-
91
- @Phony.normalize('+41 800 11 22 33').should == '41800112233'@
92
-
93
- @Phony.normalize('John: +41 44 364 35 33').should == '41443643533'@
94
-
95
- @Phony.normalize('1 (703) 451-5115').should == '17034515115'@
96
-
97
- @Phony.normalize('1-888-407-4747').should == '18884074747'@
98
-
99
- @Phony.normalize('1.906.387.1698').should == '19063871698'@
100
-
101
- @Phony.normalize('+41 (044) 364 35 33').should == '41443643533'@
102
-
103
- h3(#formatting). Formatting
104
-
105
- Aliased as @Phony.formatted(number_string)@.
106
-
107
- You really need to give it a normalized phone number WITH country code, so:
108
-
109
- @Phony.format('3643532')@ This is bad.
110
-
111
- These, however, are splendid:
112
-
113
- @Phony.format('41443643532').should == '+41 44 364 35 32'@
114
-
115
- @Phony.format('41800112233').should == '+41 800 11 22 33'@
116
-
117
- @Phony.format('43198110').should == '+43 1 98110'@
118
-
119
- @Phony.format('18705551122').should == '+1 870 555 1122'@
120
-
121
- h4(#international). International
122
-
123
- @Phony.format('18091231234', :format => :international).should == '+1 809 123 1234'@
124
-
125
- @Phony.format('43198110', :format => :international).should == '+43 1 98110'@
126
-
127
- @Phony.format('43198110', :format => :international_absolute).should == '+43 1 98110'@
128
-
129
- @Phony.format('33142278186', :format => :+).should == '+33 1 42 27 81 86'@
130
-
131
- @Phony.format('43198110', :format => :international_relative).should == '0043 1 98110'@
132
-
133
- @Phony.format('4233841148', :format => :international_relative).should == '00423 384 11 48'@
134
-
135
- h4(#spaces). With spaces
136
-
137
- @Phony.format('18091231234', :format => :international, :spaces => '').should == '+18091231234'@
138
-
139
- @Phony.format('43198110', :format => :international, :spaces => '').should == '+43198110'@
140
-
141
- @Phony.format('43198110', :format => :international_absolute, :spaces => '').should == '+43198110'@
142
-
143
- @Phony.format('33142278186', :format => :+, :spaces => '').should == '+33142278186'@
144
-
145
- @Phony.format('43198110', :format => :international_relative, :spaces => '').should == '0043198110'@
146
-
147
- @Phony.format('4233841148', :format => :international_relative, :spaces => '').should == '004233841148'@
148
-
149
- h4(#special). With special spaces
150
-
151
- @Phony.format('18091231234', :format => :international, :spaces => :-).should == '+1-809-123-1234'@
152
-
153
- @Phony.format('43198110', :format => :international, :spaces => :-).should == '+43-1-98110'@
29
+ With Rails? Check out: https://github.com/joost/phony_rails.
154
30
 
155
- @Phony.format('43198110', :format => :international_absolute, :spaces => :-).should == '+43-1-98110'@
31
+ With Bundler: Append @gem 'phony'@ to your @Gemfile@ and @bundle install@ it.
156
32
 
157
- @Phony.format('33142278186', :format => :+, :spaces => :-).should == '+33-1-42-27-81-86'@
33
+ Without Bundler: Run @gem install phony@ from your command line.
158
34
 
159
- @Phony.format('43198110', :format => :international_relative, :spaces => :-).should == '0043-1-98110'@
35
+ h2(#usage). Usage docs
160
36
 
161
- @Phony.format('4233841148', :format => :international_relative, :spaces => :-).should == '00423-384-11-48'@
37
+ Phony uses "qed":https://github.com/rubyworks/qed as docs and to run its functional tests. Start here for usage docs: "Usage index":./qed/index.md.
162
38
 
163
- h4(#national). National
39
+ h3(#normalizing). Phony.normalize(number)
164
40
 
165
- @Phony.format('41443643532', :format => :national).should == '044 364 35 32'@
41
+ Normalize intelligently removes all non-numeric characters of a number. Do it before storing a number in a DB.
166
42
 
167
- @Phony.format('41800112233', :format => :national).should == '0800 11 22 33'@
43
+ "Phony.normalize docs":./qed/normalize.md
168
44
 
169
- @Phony.format('43198110', :format => :national).should == '01 98110'@
45
+ @Phony.normalize('1-888-407-4747').assert == '18884074747'@
170
46
 
171
- h4(#local). Local
47
+ h3(#formatting). Phony.format(number, options = {})
172
48
 
173
- @Phony.format('41443643532', :format => :local).should == '364 35 32'@
49
+ Format formats a normalized number according to a country's predominant formatting. Lots of options for int'l, national, local formatting.
174
50
 
175
- @Phony.format('493038625454', :format => :local).should == '386 25454'@
51
+ "Phony.format docs":./qed/format.md
176
52
 
177
- h3(#splitting). Splitting
53
+ @Phony.format('41443643532').assert == '+41 44 364 35 32'@
178
54
 
179
- You really need to give it a normalized phone number WITH country code, so:
55
+ h3(#plausibility). Phony.plausible?(number, options = {})
180
56
 
181
- @Phony.split('3643532')@ This no.
57
+ Is a number plausible?
182
58
 
183
- Phony is happy with these:
59
+ "Phony.plausible? docs":./qed/plausibility.md
184
60
 
185
- @Phony.split('43198110').should == ['43', '1', '98110']@
61
+ @Phony.assert.plausible?('+41 44 111 22 33')@
186
62
 
187
- @Phony.split('33112345678').should == ['33', '1', '12','34','56','78']@
63
+ h3(#splitting). Phony.split(number)
188
64
 
189
- @Phony.split('4976112345').should == ['49', '761', '123', '45']@
65
+ Split a number into its parts: CC, NDC, local.
190
66
 
191
- @Phony.split('3928061371').should == ['39', '2', '806', '1371']@
67
+ "Phony.split docs":./qed/split.md
192
68
 
193
- @Phony.split('41443643532').should == ['41', '44', '364', '35', '32']@
69
+ @Phony.split('3928061371').assert == ['39', '2', '806', '1371']@
194
70
 
195
- @Phony.split('15551115511').should == ['1', '555', '111', '5511']@
71
+ h2. List of Handled Countries
196
72
 
197
- @Phony.split('6491234567').should == ['64', '9', '123', '4567']@
73
+ Mildly unmaintained list: Abhas, Afghan, Algerian, Argentinan, Austrian, Australian, Azerbaijani, Belgian, Brazilian, Cambodian, Chilean, Chinese, Croatian, Cuban, Cypriot, Czech, Danish, Dutch, Egyptian, El Salvadorian, Estonian, French, German, Ghanan, Gibraltar, Greek, Haiti, Hong Kong, Hungarian, Indian, Iran, Irish, Israel, Italian, Kazakh, Liberian, Lithuanian, Luxembourgian, Malaysian, Malta, Mexican, Monaco, Morocco, New Zealand, Nigerian, Norwegian, Peruvian, Polish, Romanian, Russian, Rwandan, Seychelles, Singapore, Slovakian, South African, South Korean, South Osetian, Spanish, Sri Lankan, Sudan, Swedish, Swiss, Thailand, Tunisian, Turkish, Liechtenstein, UK, US, Venezuelan, Vietnamese, and Zambian numbers.
198
74
 
199
- @Phony.split('41800334455').should == ['41', '800', '33', '44', '55']@
75
+ h2. License
200
76
 
201
- Note: There is also a ! version of each of these methods which
202
- will destroy the original string and return a new (or old) one.
203
- Just work only with the returned value, and you will be fine.
77
+ MIT.
78
+ See "LICENSE":./LICENSE file.
@@ -402,12 +402,14 @@ ndcs_with_5_subscriber_numbers = %w(
402
402
  Phony.define do
403
403
  country '81',
404
404
  trunk('0') |
405
- one_of(ndcs_with_5_subscriber_numbers) >> split(3,2) |
406
- one_of(ndcs_with_6_subscriber_numbers) >> split(3,3) |
405
+ one_of('20', '50', '60', '70', '90') >> split(4,4) | # mobile, VoIP telephony
406
+ one_of(ndcs_with_5_subscriber_numbers) >> split(1,4) |
407
+ one_of(ndcs_with_6_subscriber_numbers) >> split(2,4) |
407
408
  one_of(%w(120 800)) >> split(3,3) | # freephone
408
- one_of(ndcs_with_7_subscriber_numbers) >> split(4,3) |
409
+ one_of(ndcs_with_7_subscriber_numbers) >> split(3,4) |
409
410
  one_of(ndcs_with_8_subscriber_numbers) >> split(4,4) |
410
- one_of('20', '50', '60', '70', '90') >> split(4,4) | # mobile, VoIP telephony
411
411
  # TODO: 91(NDC) N(S)N length: 5-13 - Non-geographic number (Direct subscriber telephone service (legacy))
412
- fixed(2) >> split(4,4)
412
+ fixed(2) >> split(4,4),
413
+ :local_space => :- ,
414
+ :space => :-
413
415
  end
data/lib/phony/country.rb CHANGED
@@ -97,23 +97,20 @@ module Phony
97
97
  type % { :trunk => trunk, :cc => @cc, :ndc => ndc, :local => local }
98
98
  when nil, :international_absolute, :international, :+
99
99
  if ndc
100
- ndc = parentheses ? "(#{ndc})" : ndc
101
- format_with_ndc(@@international_absolute_format, @cc, ndc, local, space)
100
+ format_with_ndc(@@international_absolute_format, @cc, format_ndc(ndc, parentheses), local, space)
102
101
  else
103
102
  format_without_ndc(@@international_absolute_format, @cc, local, space)
104
103
  end
105
104
  when :international_relative
106
105
  if ndc
107
- ndc = parentheses ? "(#{ndc})" : ndc
108
- format_with_ndc(@@international_relative_format, @cc, ndc, local, space)
106
+ format_with_ndc(@@international_relative_format, @cc, format_ndc(ndc, parentheses), local, space)
109
107
  else
110
108
  format_without_ndc(@@international_relative_format, @cc, local, space)
111
109
  end
112
110
  when :national
113
111
  trunk &&= trunk.format(space, use_trunk)
114
112
  if ndc && !ndc.empty?
115
- ndc = parentheses ? "(#{ndc})" : ndc
116
- @@national_format % [trunk, ndc, space, local]
113
+ @@national_format % [trunk, format_ndc(ndc, parentheses), space, local]
117
114
  else
118
115
  @@national_format % [trunk, nil, nil, local]
119
116
  end
@@ -121,6 +118,9 @@ module Phony
121
118
  local
122
119
  end
123
120
  end
121
+ def format_ndc ndc, parentheses
122
+ parentheses ? "(#{ndc})" : ndc
123
+ end
124
124
  def format_with_ndc format, cc, ndc, local, space
125
125
  format % [cc, space, ndc, space, local]
126
126
  end
@@ -12,12 +12,16 @@ module Phony
12
12
  country_for local_splitter
13
13
  end
14
14
 
15
+ #
16
+ #
15
17
  def country_for local_splitter
16
18
  Phony::Country.new Phony::NationalCode.new(self, local_splitter)
17
19
  end
18
-
20
+
21
+ # TODO Remove?
22
+ #
19
23
  def reserved
20
-
24
+
21
25
  end
22
26
 
23
27
  end
@@ -45,573 +45,7 @@ describe 'plausibility' do
45
45
  end
46
46
  end
47
47
 
48
- it 'does not change the given number' do
49
- number = "123-123-1234"
50
-
51
- Phony.plausible? number
52
-
53
- number.should == '123-123-1234'
54
- end
55
-
56
- it 'handles small numbers' do
57
- Phony.plausible?('353').should be_false
58
- end
59
-
60
- it 'is correct' do
61
- Phony.plausible?('+1911').should be_false
62
- end
63
- it "correctly plausibilizes to#{}do countries" do
64
- Phony.plausible?('6327332350').should be_true
65
- end
66
- it 'is correct' do
67
- Phony.plausible?('45 44 11 22 33').should be_true
68
- end
69
- it 'is correct' do
70
- Phony.plausible?('+4231231212').should be_true
71
- end
72
- it 'is correct' do
73
- Phony.plausible?('+4755121212').should be_true
74
- end
75
- it 'is correct' do
76
- Phony.plausible?('+475512121').should be_false
77
- end
78
- it 'is correct' do
79
- Phony.plausible?('+47551212121').should be_false
80
- end
81
- it 'is correct' do
82
- Phony.plausible?('010').should be_false
83
- end
84
- it 'is correct' do
85
- Phony.plausible?("+460000").should be_false
86
- end
87
- it 'is correct' do
88
- Phony.plausible?('0000000').should be_false
89
- end
90
- it 'is correct for zeros in number' do
91
- Phony.plausible?('+00 00 000 00 01').should be_false
92
- end
93
- it 'is correct for zeros in number' do
94
- Phony.plausible?('00 00 000 00 01').should be_false
95
- end
96
- it 'is correct' do
97
- Phony.plausible?('hello').should be_false
98
- end
99
- it "is correct" do
100
- Phony.plausible?('+41 44 111 22 33').should be_true
101
- end
102
- it "is correct for explicit checks" do
103
- Phony.plausible?('+41 44 111 22 33', cc: '41').should be_true
104
- end
105
- it "is correct for explicit checks" do
106
- Phony.plausible?('+41 44 111 22 33', ndc: '44').should be_true
107
- end
108
- it "is correct for explicit checks" do
109
- Phony.plausible?('+41 44 111 22 33', cc: '1').should be_false
110
- end
111
- it "is correct for explicit checks" do
112
- Phony.plausible?('+41 44 111 22 33', ndc: '43').should be_false
113
- end
114
- it "is correct for explicit checks" do
115
- Phony.plausible?('+41 44 111 22 33', cc: '41', ndc: '44').should be_true
116
- end
117
- it "works with regexps" do
118
- Phony.plausible?('+41 44 111 22 33', cc: /4(0|2)/, ndc: /4(4|5)/).should be_false
119
- end
120
- it "works with regexps" do
121
- Phony.plausible?('+41 44 111 22 33', cc: /4(0|1)/, ndc: /4(4|5)/).should be_true
122
- end
123
-
124
- context 'Length validation' do
125
- it 'works for Swiss cases' do
126
- Phony.plausible?('+41 44 111 22 3').should be_false # Not long enough is not ok.
127
- # Phony.plausible?('+41 44 111 22 33 4').should be_true # TODO Too long is ok – we don't know about extensions.
128
- end
129
- end
130
-
131
48
  context 'specific countries' do
132
- it "" do
133
- Phony.plausible?('+43 699 00000000').should be_true
134
- end
135
-
136
- it "is correct for Austria" do
137
- Phony.plausible?('+43 1 000000').should be_true
138
- Phony.plausible?('+43 1 0000000').should be_true
139
- Phony.plausible?('+43 501 12345').should be_true
140
- Phony.plausible?('+43 501 1234').should be_false # too short
141
- Phony.plausible?('+43 501 123456').should be_false # too long
142
- Phony.plausible?('+43 800 123456789').should be_true
143
- Phony.plausible?('+43 3115 3307').should be_true # See issue #246 on Github.
144
-
145
- # Mobile
146
- Phony.plausible?('+43 676 0000000').should be_true
147
- Phony.plausible?('+43 681 00000000').should be_true
148
- Phony.plausible?('+43 688 0000000').should be_true
149
- Phony.plausible?('+43 699 00000000').should be_true
150
- # 663 mobile numbers have 6 digits
151
- Phony.plausible?('+43 663 000000').should be_true
152
- # mobile numbers can have from 7 to 10 digits in the subscriber number
153
- Phony.plausible?('+43 664 1234 567').should be_true
154
- Phony.plausible?('+43 664 1234 5678').should be_true
155
- Phony.plausible?('+43 664 1234 56789').should be_true
156
- Phony.plausible?('+43 664 1234 567890').should be_true
157
- end
158
-
159
- it "is correct for Belgian numbers" do
160
- Phony.plausible?('+32 3 241 11 32').should be_true
161
- Phony.plausible?('0032 3 241 11 32').should be_true
162
- Phony.plausible?('0032 (0) 3 241 11 32').should be_true
163
- end
164
-
165
- it "is correct for Albania" do
166
- Phony.plausible?('+355 85 123456').should be_true
167
- Phony.plausible?('+355 85 12345').should be_false # too short
168
- Phony.plausible?('+355 85 1234567').should be_false # too long
169
- end
170
-
171
- it "is correct for Angola" do
172
- Phony.plausible?('+244 852 123 456').should be_true
173
- Phony.plausible?('+244 852 123').should be_false # too short
174
- Phony.plausible?('+244 852 123 4567').should be_false # too long
175
- end
176
-
177
- it "is correct for Andorra" do
178
- Phony.plausible?('+376 712345').should be_true
179
- Phony.plausible?('+376 71234').should be_false # too short
180
- Phony.plausible?('+376 7123456').should be_false # too long
181
- Phony.plausible?('+376 712345').should be_true
182
- Phony.plausible?('+376 71234').should be_false # too short
183
- Phony.plausible?('+376 7123456').should be_false # too long
184
- end
185
-
186
- it "is correct for Armenia" do
187
- Phony.plausible?('+374 12345678').should be_true
188
- Phony.plausible?('+374 1234567').should be_false # too short
189
- Phony.plausible?('+374 123456789').should be_false # too long
190
- end
191
-
192
- it "is correct for Aruba" do
193
- # Landline
194
- Phony.plausible?('+297 525 5200').should be_true
195
- Phony.plausible?('+297 586 6555').should be_true
196
- # Mobile
197
- Phony.plausible?('+297 737 7667').should be_true
198
-
199
- Phony.plausible?('+297 520 000').should be_false # too short
200
- Phony.plausible?('+297 520 00000').should be_false # too long
201
- end
202
-
203
- it "is correct for Azerbaijan" do
204
- Phony.plausible?('+994 12 1234567').should be_true
205
- Phony.plausible?('+994 12 12345').should be_false # too short
206
- Phony.plausible?('+994 12 12345678').should be_false # too long
207
- end
208
-
209
- it 'is correct for Bangladesh' do
210
- Phony.plausible?('+880 2 1234567').should be_true
211
- Phony.plausible?('+880 2 12345678').should be_false # too long
212
- Phony.plausible?('+880 2 123456').should be_false # too short
213
-
214
- Phony.plausible?('+880 9020 12345').should be_true
215
- Phony.plausible?('+880 9020 123456').should be_false # too long
216
- Phony.plausible?('+880 9020 1234').should be_false # too short
217
-
218
- # ndc with several subscriber number length
219
- Phony.plausible?('+880 3035 1234').should be_true
220
- Phony.plausible?('+880 3035 123').should be_true
221
- Phony.plausible?('+880 3035 12').should be_false # too short
222
- Phony.plausible?('+880 3035 12345').should be_false # too long
223
- end
224
-
225
- it 'is correct for Bahrain' do
226
- Phony.plausible?('+973 1234 5678').should be_true
227
- Phony.plausible?('+973 1234 567').should be_false # too short
228
- Phony.plausible?('+973 1234 56789').should be_false # too long
229
- end
230
-
231
- it 'is correct for Belarus' do
232
- Phony.plausible?('+375 152 123456').should be_true
233
- Phony.plausible?('+375 152 12345').should be_false # too short
234
- Phony.plausible?('+375 152 1234567').should be_false # too long
235
-
236
- Phony.plausible?('+375 800 123').should be_true
237
- Phony.plausible?('+375 800 1234').should be_true
238
- Phony.plausible?('+375 800 1234567').should be_true
239
- Phony.plausible?('+375 800 123456').should be_false
240
- Phony.plausible?('+375 800 12345678').should be_false
241
- end
242
-
243
- it 'is correct for Cambodia' do
244
- # http://en.wikipedia.org/wiki/Telecommunications_in_Cambodia#Mobile_networks
245
- # http://en.wikipedia.org/wiki/Telephone_numbers_in_Cambodia
246
- # http://www.itu.int/dms_pub/itu-t/oth/02/02/T02020000230001MSWE.doc
247
-
248
- Phony.plausible?("+855312345678").should be_true # Beeline (7 digit id)
249
- Phony.plausible?("+85531234567").should be_false # Beeline (too short)
250
- Phony.plausible?("+85560234567").should be_true # Beeline (6 digit id)
251
- Phony.plausible?("+855602345678").should be_false # Beeline (too long)
252
-
253
- Phony.plausible?("+855762345678").should be_true # Mobitel (7 digit id)
254
- Phony.plausible?("+85576234567").should be_false # Mobitel (too short)
255
- Phony.plausible?("+85517234567").should be_true # Mobitel (6 digit id)
256
- Phony.plausible?("+855172345678").should be_false # Mobitel (too long)
257
- Phony.plausible?("+85512234567").should be_true # Mobitel (6 digit id)
258
- Phony.plausible?("+855121345678").should be_true # Mobitel (7 digit id)
259
- Phony.plausible?("+85512123456").should be_false # Mobitel (6 digit invalid)
260
-
261
- Phony.plausible?("+855383001801").should be_true # CooTel (7 digit id)
262
- Phony.plausible?("+85538300180").should be_false # CooTel (too short)
263
-
264
- Phony.plausible?("+85518234567").should be_true # Excell (6 digit id)
265
- Phony.plausible?("+855182345678").should be_false # Excell (too long)
266
-
267
- Phony.plausible?("+855882345678").should be_true # Metfone (7 digit id)
268
- Phony.plausible?("+85588234567").should be_false # Metfone (too short)
269
- Phony.plausible?("+855972345678").should be_true # Metfone (7 digit id)
270
- Phony.plausible?("+85597234567").should be_false # Metfone (too short)
271
- Phony.plausible?("+855714822684").should be_true # Metfone (7 digit id)
272
- Phony.plausible?("+85571482268").should be_false # Metfone (too short)
273
-
274
- Phony.plausible?("+85513234567").should be_true # qb (6 digit id)
275
- Phony.plausible?("+855132345678").should be_false # qb (too long)
276
-
277
- Phony.plausible?("+855962345678").should be_true # Smart (7 digit id)
278
- Phony.plausible?("+85596234567").should be_false # Smart (too short)
279
- Phony.plausible?("+85510234567").should be_true # Smart (6 digit id)
280
- Phony.plausible?("+855102345678").should be_false # Smart (too long)
281
-
282
- # AXXXXX (A must be between 1 and 9)
283
- Phony.plausible?("+85512023456").should be_false # invalid numbering plan
284
- Phony.plausible?("+855380234567").should be_false # invalid numbering plan
285
- Phony.plausible?("+85592123456").should be_true # valid for 6 digit id
286
-
287
- Phony.plausible?("+85514234567").should be_false # invalid mobile operator
288
- Phony.plausible?("+85527234567").should be_false # invalid ndc
289
-
290
- Phony.plausible?("+85523471234").should be_true # Fixed line (NDC + '47' + 4 digit id)
291
- Phony.plausible?("+855234712345").should be_true # Fixed line (NDC + '47' + 5 digit id)
292
- Phony.plausible?("+85523123456").should be_false # Fixed line (NDC + invalid A)
293
- end
294
-
295
- it 'is correct for Croatia' do
296
- # Landline
297
- expect(Phony.plausible?('+385 21 695900')).to be_true
298
- expect(Phony.plausible?('+385 1 4566 666')).to be_true
299
-
300
- expect(Phony.plausible?('+385 21 12345')).to be_false, "too short"
301
- expect(Phony.plausible?('+385 21 1234567')).to be_false, "too long"
302
-
303
- # Mobile
304
- expect(Phony.plausible?('+385 91 896 7509')).to be_true
305
-
306
- expect(Phony.plausible?('+385 91 123456')).to be_false, "too short"
307
- end
308
-
309
- it "is correct for Denmark" do
310
- Phony.plausible?('+45 44 11 12 23 34').should be_false
311
- Phony.plausible?('+45 44 11 12 2').should be_false
312
- Phony.plausible?('+45 44 55 22 33').should be_true
313
- end
314
-
315
- it "is correct for Estonia" do
316
- # the 5xxxx mobile numbers can be 7 or 8 digits (ndc + subscriber) long
317
- Phony.plausible?('+372 532 12345').should be_true
318
- Phony.plausible?('+372 532 1234').should be_true
319
- Phony.plausible?('+372 532 123').should be_false
320
- Phony.plausible?('+372 532 123456').should be_false
321
-
322
- # the 81x/82x are only 8 digits
323
- Phony.plausible?('+372 822 12345').should be_true
324
- Phony.plausible?('+372 812 12345').should be_true
325
- Phony.plausible?('+372 822 1234').should be_false
326
- Phony.plausible?('+372 812 1234').should be_false
327
- Phony.plausible?('+372 822 123').should be_false
328
- Phony.plausible?('+372 822 123456').should be_false
329
- end
330
-
331
- it 'is correct for Netherlands' do
332
- Phony.plausible?('+31 6 12 34 56 78').should be_true
333
- Phony.plausible?('+31 6 12 34 56 7').should be_false
334
- Phony.plausible?('+31 20 123 5678').should be_true
335
- Phony.plausible?('+31 20 123 567').should be_false
336
- Phony.plausible?('+31 221 123 567').should be_true
337
- Phony.plausible?('+31 221 123 56').should be_false
338
- Phony.plausible?('+31 880 450 245').should be_true
339
- Phony.plausible?('+31 880 450 24').should be_false
340
- Phony.plausible?('+31 900 123 4567').should be_true
341
- Phony.plausible?('+31 900 001 00').should be_false
342
- Phony.plausible?('+31 800 6080').should be_true
343
- end
344
-
345
- it 'is correct for Egypt' do
346
- Phony.plausible?('+20 800 1234567').should be_true
347
- Phony.plausible?('+20 800 12345678').should be_false
348
- Phony.plausible?('+20 2 12345678').should be_true
349
- Phony.plausible?('+20 2 1234567').should be_false
350
- Phony.plausible?('+20 3 1234567').should be_true
351
- Phony.plausible?('+20 3 12345678').should be_false
352
- Phony.plausible?('+20 40 1234567').should be_true
353
- Phony.plausible?('+20 40 12345678').should be_false
354
- Phony.plausible?('+20 10 12345678').should be_true
355
- Phony.plausible?('+20 10 1234567').should be_false
356
- Phony.plausible?('+20 11 12345678').should be_true
357
- Phony.plausible?('+20 11 1234567').should be_false
358
- Phony.plausible?('+20 12 12345678').should be_true
359
- Phony.plausible?('+20 12 1234567').should be_false
360
- end
361
-
362
- it 'is correct for Germany' do
363
- Phony.plausible?('+49 209 169 - 0').should be_true # Gelsenkirchen
364
- Phony.plausible?('+49 209 169 - 3530').should be_true # Gelsenkirchen
365
- Phony.plausible?('+49 40 123 45678').should be_true
366
- Phony.plausible?('+49 40 123 456789').should be_true # TODO ?
367
- Phony.plausible?('+49 160 123 1234').should be_true # Mobile Number 7 digits
368
- Phony.plausible?('+49 160 123 12345').should be_true # Mobile Number 8 digits
369
- Phony.plausible?('+49 171 123 4567').should be_true
370
- Phony.plausible?('+49 171 123 45678').should be_true # is a valid number according German authority "bundesnetzagentur": http://www.bundesnetzagentur.de/SharedDocs/Downloads/DE/Sachgebiete/Telekommunikation/Unternehmen_Institutionen/Nummerierung/Rufnummern/ONRufnr/NummernplanOrtsnetzrufnummern.pdf?__blob=publicationFile&v=2 (04.24.2014)
371
- Phony.plausible?('+49 177 123 1234').should be_true
372
- Phony.plausible?('+49 176 123 12345').should be_true
373
- Phony.plausible?('+49 991 1234').should be_true # stricter 3 digit ndc rules
374
- Phony.plausible?('+49 2041 123').should be_true # Grandfathered numbers.
375
- Phony.plausible?('+49 2041 1234567').should be_true
376
- Phony.plausible?('+49 31234 123456').should be_true
377
- Phony.plausible?('+49 7141 12345670').should be_true
378
- Phony.plausible?('+49 1609 1234567').should be_true # Bug: https://github.com/floere/phony/issues/146
379
- Phony.plausible?('+49 800 1234567').should be_true
380
- Phony.plausible?('+49 1805 878323').should be_true
381
-
382
- # Extended service numbers
383
- # http://www.bundesnetzagentur.de/SharedDocs/Downloads/DE/Sachgebiete/Telekommunikation/Unternehmen_Institutionen/Nummerierung/Rufnummern/0800/0800_Nummernplan.pdf?__blob=publicationFile&v=1
384
- Phony.plausible?('+49 800 222 3400 10').should be_true
385
- Phony.plausible?('+49 800 222 3400 100').should be_true
386
- Phony.plausible?('+49 800 222 3400 1000').should be_false
387
-
388
- # Following tests implement specifications from
389
- # http://www.bundesnetzagentur.de/SharedDocs/Downloads/DE/Sachgebiete/Telekommunikation/Unternehmen_Institutionen/Nummerierung/Rufnummern/ONRufnr/NummernplanOrtsnetzrufnummern.pdf?__blob=publicationFile&v=2 (04.24.2014)
390
- # Page 3
391
- Phony.plausible?('+49 89 12345678').should be_true # NZ-E
392
- Phony.plausible?('+49 89 123456789').should be_true # NZ-E & NZ-Z
393
- Phony.plausible?('+49 89 1234567890').should be_true # NZ-Z
394
- Phony.plausible?('+49 209 1234567').should be_true # NZ-E
395
- Phony.plausible?('+49 209 12345678').should be_true # NZ-E & NZ-Z
396
- Phony.plausible?('+49 209 123456789').should be_true # NZ-Z
397
- Phony.plausible?('+49 6421 123456').should be_true # NZ-E
398
- Phony.plausible?('+49 6421 1234567').should be_true # NZ-E & NZ-Z
399
- Phony.plausible?('+49 6421 12345678').should be_true # NZ-Z
400
- Phony.plausible?('+49 33053 12345').should be_true # NZ-E
401
- Phony.plausible?('+49 33053 123456').should be_true # NZ-E & NZ-Z
402
- Phony.plausible?('+49 33053 1234567').should be_true # NZ-Z
403
- # Point 2.3c) Numbers can be up to 13 Digits long without prefix according to E.164
404
- Phony.plausible?('+49 33053 12345678').should be_true
405
- Phony.plausible?('+49 6421 123456789').should be_true
406
- Phony.plausible?('+49 209 1234567890').should be_true
407
- Phony.plausible?('+49 40 12345678901').should be_true
408
- end
409
-
410
- it 'is correct for Israel' do
411
- Phony.plausible?('+972 2 123 1234').should be_true
412
- Phony.plausible?('+972 59 123 1234').should be_true
413
- end
414
-
415
- it 'is correct for Italy' do
416
- Phony.plausible?('+39 06 1234 4567').should be_true
417
-
418
- Phony.plausible?('+39 035 00000').should be_false
419
- Phony.plausible?('+39 035 000000').should be_true
420
- Phony.plausible?('+39 015 8407324').should be_true
421
-
422
- Phony.plausible?('+39 0471 123 456').should be_true
423
-
424
- # Issue #221
425
- Phony.plausible?('+39 081 1925 2698').should be_true
426
-
427
- # Mobile
428
- Phony.plausible?('+39 335 123').should be_false
429
- Phony.plausible?('+39 335 123 45').should be_false
430
- Phony.plausible?('+39 335 123 456').should be_true
431
- Phony.plausible?('+39 335 123 4567').should be_true
432
- Phony.plausible?('+39 335 123 45678').should be_true
433
- Phony.plausible?('+39 335 123 456789').should be_false
434
- end
435
-
436
- it 'is correct for Malaysia' do
437
- Phony.plausible?('+60 14 123 1234').should be_true
438
- Phony.plausible?('+60 11 123 12345').should be_true
439
- Phony.plausible?('+60 14 1234 12').should be_false # too short
440
- Phony.plausible?('+60 14 1234 12345').should be_false # too long
441
- end
442
-
443
- it 'is correct for Mexico' do
444
- Phony.plausible?('+52 1 55 1212 1212').should be_true
445
- Phony.plausible?('+52 55 1212 1212').should be_true
446
- Phony.plausible?('+52 664 123 1212').should be_true
447
- Phony.plausible?('+52 1 664 123 1212').should be_true
448
- Phony.plausible?('+52 044 664 123 1212').should be_true
449
- Phony.plausible?('+52 1 55 1212 1212 3').should be_false # too long
450
- Phony.plausible?('+52 55 1212 121').should be_false # too short
451
- end
452
-
453
- it "is correct for Netherlands Antilles" do
454
- Phony.plausible?('+599 1234567').should be_true
455
- Phony.plausible?('+599 123456').should be_false # too short
456
- Phony.plausible?('+599 12345678').should be_false # too long
457
- end
458
-
459
- it 'is correct for New Zeland' do
460
- Phony.plausible?('+64 21 123 456').should be_true
461
- Phony.plausible?('+64 21 123 4567').should be_true
462
- Phony.plausible?('+64 9 379 1234').should be_true
463
- Phony.plausible?('+64 21 12 345 678').should be_true
464
- Phony.plausible?('+64 21 1234 56789').should be_false # to long
465
- Phony.plausible?('+64 21 12345').should be_false # to short
466
- end
467
-
468
- it 'is correct for Nigerian numbers' do
469
- Phony.plausible?('+234 700 766 1234').should be_true
470
- Phony.plausible?('+234 701 766 1234').should be_true
471
- Phony.plausible?('+234 702 766 1234').should be_true
472
- Phony.plausible?('+234 703 766 1234').should be_true
473
- Phony.plausible?('+234 704 766 1234').should be_true
474
- Phony.plausible?('+234 705 766 1234').should be_true
475
- Phony.plausible?('+234 706 766 1234').should be_true
476
- Phony.plausible?('+234 707 766 1234').should be_true
477
- Phony.plausible?('+234 708 766 1234').should be_true
478
- Phony.plausible?('+234 709 766 1234').should be_true
479
- Phony.plausible?('+234 800 766 1234').should be_true
480
- Phony.plausible?('+234 801 766 1234').should be_true
481
- Phony.plausible?('+234 802 766 1234').should be_true
482
- Phony.plausible?('+234 803 766 1234').should be_true
483
- Phony.plausible?('+234 804 766 1234').should be_true
484
- Phony.plausible?('+234 805 766 1234').should be_true
485
- Phony.plausible?('+234 806 766 1234').should be_true
486
- Phony.plausible?('+234 807 766 1234').should be_true
487
- Phony.plausible?('+234 808 766 1234').should be_true
488
- Phony.plausible?('+234 809 766 1234').should be_true
489
- Phony.plausible?('+234 900 766 1234').should be_true
490
- Phony.plausible?('+234 901 766 1234').should be_true
491
- Phony.plausible?('+234 902 766 1234').should be_true
492
- Phony.plausible?('+234 903 766 1234').should be_true
493
- Phony.plausible?('+234 904 766 1234').should be_true
494
- Phony.plausible?('+234 905 766 1234').should be_true
495
- Phony.plausible?('+234 906 766 1234').should be_true
496
- Phony.plausible?('+234 907 766 1234').should be_true
497
- Phony.plausible?('+234 908 766 1234').should be_true
498
- Phony.plausible?('+234 909 766 1234').should be_true
499
- Phony.plausible?('+234 810 766 1234').should be_true
500
- Phony.plausible?('+234 811 766 1234').should be_true
501
- Phony.plausible?('+234 812 766 1234').should be_true
502
- Phony.plausible?('+234 813 766 1234').should be_true
503
- Phony.plausible?('+234 814 766 1234').should be_true
504
- Phony.plausible?('+234 815 766 1234').should be_true
505
- Phony.plausible?('+234 816 766 1234').should be_true
506
- Phony.plausible?('+234 817 766 1234').should be_true
507
- Phony.plausible?('+234 818 766 1234').should be_true
508
- Phony.plausible?('+234 819 766 1234').should be_true
509
-
510
- Phony.plausible?('+234 807 766 123').should be_false # too short
511
- end
512
-
513
- it "is correct for Portugese numbers" do
514
- Phony.plausible?('+351 800 123456').should be_true
515
- Phony.plausible?('+351 90 1234567').should be_true
516
- Phony.plausible?('+351 90 123456').should be_false
517
- Phony.plausible?('+351 123 123456').should be_true
518
- Phony.plausible?('+351 123 1234567').should be_false
519
- end
520
-
521
- it "is correct for Russia" do
522
- Phony.plausible?('+7 800 2000 600').should be_true
523
- Phony.plausible?('+7 960 301 23 45').should be_true
524
- Phony.plausible?('+7 800 2000 60').should be_false # too short
525
- Phony.plausible?('796030123451').should be_false # too long
526
- end
527
-
528
- it "is correct for Slovenian numbers" do
529
- Phony.plausible?('+386 41 123 456').should be_true
530
- Phony.plausible?('+386 1 320 1234').should be_true
531
- Phony.plausible?('+386 41 123 4567').should be_false
532
- end
533
-
534
- it "is correct for Swiss numbers" do
535
- Phony.plausible?('+41 44 111 22 33').should be_true
536
- Phony.plausible?('+41 44 111 22 334').should be_false
537
- Phony.plausible?('+41 44 111 22').should be_false
538
- Phony.plausible?('+41 (044) 364 35 33').should be_true
539
- end
540
-
541
- it "is correct for Swedish numbers" do
542
- Phony.plausible?('+46 8 506 10 60').should be_true
543
- Phony.plausible?('+46 8 506 106 00').should be_true
544
- Phony.plausible?('+46 19 764 22 00').should be_true
545
- Phony.plausible?('+46 19 20 88 50').should be_true
546
- Phony.plausible?('+46 19 20 88').should be_false # too short
547
- end
548
-
549
- it "is correct for Vietnamese numbers" do
550
- Phony.plausible?('+84 8 3827 9666').should be_true
551
- Phony.plausible?('+84 4 3926 1720').should be_true
552
- Phony.plausible?('+84 091 123-4567').should be_true
553
- Phony.plausible?('+84 0167 123456').should be_true
554
- Phony.plausible?('+84 1 1234').should be_false # too short
555
- Phony.plausible?('+84 12 3456 7891 0111213').should be_false # too long
556
- end
557
-
558
- it "is correct for US numbers" do
559
- # Still need E164 conform numbers.
560
- #
561
- Phony.plausible?('4346667777', cc: '1').should be_false
562
-
563
- # Automatic country checking.
564
- #
565
- Phony.plausible?('1-4346667777').should be_true
566
- Phony.plausible?('1-800-692-7753').should be_true
567
- Phony.plausible?('1-911').should be_false
568
- Phony.plausible?('1-911-123-1234').should be_false
569
- Phony.plausible?('1-411-123-1234').should be_false
570
- Phony.plausible?('1-040-123-1234').should be_false
571
- Phony.plausible?('143466677777').should be_false # too long
572
- Phony.plausible?('143466677').should be_false # too short
573
-
574
- # With string constraints.
575
- #
576
- Phony.plausible?('14346667777', cc: '1').should be_true
577
- Phony.plausible?('14346667777', ndc: '434').should be_true
578
- Phony.plausible?('14346667777', cc: '1', ndc: '434').should be_true
579
-
580
- # With regexp constraints.
581
- #
582
- Phony.plausible?('14346667777', cc: /[123]/).should be_true
583
- Phony.plausible?('14346667777', ndc: /434|435/).should be_true
584
- Phony.plausible?('14346667777', cc: /[123]/, ndc: /434|435/).should be_true
585
- end
586
-
587
- it_is_correct_for 'Belize', :samples => '+501 205 1234'
588
- it_is_correct_for 'Benin', :samples => '+229 1234 5678'
589
- it_is_correct_for 'Bolivia', :samples => '+591 2 277 2266'
590
- it_is_correct_for 'Botswana', :samples => ['+267 80 123 456',
591
- '+267 29 567 89',
592
- '+267 463 4567',
593
- '+267 58 123 45',
594
- '+267 7 6712 345',
595
- '+267 8 1234 567']
596
- it_is_correct_for 'Colombia', :samples => ['+57 1 123 4567', '+57 310 123 4567']
597
- it_is_correct_for 'Philippines', :samples => [['+63 2 1234567', '+63 2 1234567890'],
598
- '+63 88 1234567',
599
- ['+63 920 123456', '+63 920 1234567']]
600
-
601
- it_is_correct_for 'Pakistan', :samples => ['+92 21 1234 5678',
602
- '+92 22 1234 567',
603
- '+92 232 123 456',
604
- '+92 30 1234 5678']
605
- it_is_correct_for 'Bhutan (Kingdom of)', :samples => '+975 2 889 648'
606
- it_is_correct_for 'Brunei Darussalam', :samples => '+673 5 523 876'
607
- it_is_correct_for 'Burkina Faso', :samples => '+226 1476 2312'
608
- it_is_correct_for 'Burundi', :samples => '+257 1234 5678'
609
-
610
- it_is_correct_for 'Cameroon', :samples => '+237 7372 8186'
611
- it_is_correct_for 'Cape Verde', :samples => '+238 642 3843'
612
- it_is_correct_for 'Central African Republic', :samples => '+236 1234 5678'
613
- it_is_correct_for 'Chad', :samples => '+235 1234 5678'
614
- it_is_correct_for 'Comoros', :samples => ['+269 3901 234', '+269 3401 234']
615
49
  it_is_correct_for 'Congo', :samples => '+242 1234 56789'
616
50
  it_is_correct_for 'Cook Islands', :samples => '+682 71928'
617
51
  it_is_correct_for 'Costa Rica', :samples => '+506 2 234 5678'
@@ -639,17 +73,6 @@ describe 'plausibility' do
639
73
  '+995 32 123 4567',
640
74
  '+995 342 123 456',
641
75
  '+995 596 123 456']
642
- it_is_correct_for 'Greece', :samples => ['+30 21 4234 5678',
643
- '+30 24 4234 5678',
644
- '+30 50 3457 1234',
645
- '+30 69 0123 4567',
646
- '+30 70 0123 4567',
647
- '+30 800 100 1234',
648
- '+30 801 100 1234',
649
- '+30 807 100 1234',
650
- '+30 896 100 1234',
651
- '+30 901 123 4565',
652
- '+30 909 123 4565']
653
76
  it_is_correct_for 'Greenland', :samples => '+299 922 954'
654
77
  it_is_correct_for 'Guadeloupe (French Department of)', :samples => '+590 123 456 789'
655
78
  it_is_correct_for 'Guatemala (Republic of)', :samples => ['+502 19 123 456 789',
@@ -664,51 +87,11 @@ describe 'plausibility' do
664
87
  it_is_correct_for 'Guinea-Bissau', :samples => '+245 728 6998'
665
88
  it_is_correct_for 'Guyana', :samples => '+592 263 1234'
666
89
  it_is_correct_for 'Honduras (Republic of)', :samples => '+504 12 961 637'
667
- it_is_correct_for 'Indonesia', :samples => ['+62 13 123',
668
- '+62 13 123 456',
669
- '+62 174 12',
670
- '+62 174 12 345',
671
- '+62 177 12',
672
- '+62 177 1212 3456',
673
- '+62 178 123',
674
- '+62 178 123 45',
675
- '+62 21 123 45',
676
- ['+62 21 123 4567', '+62 21 1234 5567'],
677
- '+62 22 123 45',
678
- '+62 22 123 4567',
679
- '+62 4 311 234',
680
- '+62 4 3112 3456',
681
- ['+62 6 221 2345', '+62 6 2212 3456'],
682
- '+62 70 123 456',
683
- ['+62 71 123 456', '+62 71 123 4567'],
684
- ['+62 810 123 456', '+62 810 123 4567', '+62 810 1234 5678'],
685
- ['+62 815 123 456', '+62 815 123 4567', '+62 815 1234 5678'],
686
- '+62 820 123 456',
687
- ['+62 823 123 456', '+62 823 123 4567', '+62 823 1234 5678'],
688
- '+62 870 123 45',
689
- ['+62 877 123 456', '+62 877 123 4567', '+62 877 1234 5678'],
690
- ['+62 878 123 456', '+62 878 123 4567', '+62 878 1234 5678'],
691
- ['+62 881 123 456', '+62 881 123 4567', '+62 881 1234 5678'],
692
- '+62 9 1234 567',
693
- '+62 9 123 456 789']
694
90
  it_is_correct_for 'Iraq', :samples => ['+964 1 123 4567',
695
91
  '+964 21 113 456',
696
92
  '+964 71 1234 5678']
697
- it_is_correct_for 'Japan', :samples => ['+81 3 1234 5678',
698
- '+81 120 123 456',
699
- '+81 11 1234 567',
700
- '+81 123 123 456',
701
- '+81 1267 123 45',
702
- '+81 90 1234 5678']
703
- it_is_correct_for 'Jordan (Hashemite Kingdom of)', :samples => ['+962 800 123 45',
704
- '+962 2 620 1234',
705
- '+962 7 1234 5678',
706
- '+962 7 4661 2345',
707
- '+962 900 123 45',
708
- '+962 85 123 456',
709
- '+962 70 123 456',
710
- '+962 6250 1456',
711
- '+962 8790 1456']
93
+
94
+
712
95
  it_is_correct_for 'Kiribati (Republic of)', :samples => '+686 31993'
713
96
  it_is_correct_for "Democratic People's Republic of Korea", :samples => ['+850 2 123 45',
714
97
  '+850 2 123 456 789',
@@ -723,14 +106,7 @@ describe 'plausibility' do
723
106
  '+254-20-4262 140',
724
107
  '+254-(0)20-4262 140'
725
108
  ]
726
- it_is_correct_for 'Kyrgyzstan', :samples => ['+996 312 212 345',
727
- '+996 315 212 345',
728
- '+996 3131 212 34',
729
- '+996 3946 212 34',
730
- '+996 50 123 4567',
731
- '+996 52 123 4567',
732
- '+996 58 123 4567',
733
- '+996 800 123 456']
109
+
734
110
  it_is_correct_for "Lao People's Democratic Republic", :samples => ['+856 96 443 333',
735
111
  '+856 30 443 3334',
736
112
  '+856 20 4433 3334']
@@ -769,21 +145,6 @@ describe 'plausibility' do
769
145
  '+373 241 123 45',
770
146
  '+373 605 123 45',
771
147
  '+373 803 123 45']
772
- it_is_correct_for 'Montenegro', :samples => ['+382 80 123 456',
773
- ['+382 20 123 45', '+382 20 123 456'],
774
- '+382 32 123 456',
775
- '+382 78 103 456',
776
- '+382 63 123',
777
- '+382 63 123 456 7890',
778
- '+382 77 103 456',
779
- '+382 94 103 456',
780
- '+382 88 103 456',
781
- '+382 68 12',
782
- '+382 68 12 1234 5678',
783
- '+382 68 432 163',
784
- '+382 69 705 542',
785
- '+382 70 123',
786
- '+382 70 123 456 7890']
787
148
  it_is_correct_for 'Namibia', :samples => ['+264 6751 613 24',
788
149
  '+264 67 175 890',
789
150
  '+264 63 088 612 345',
@@ -804,29 +165,6 @@ describe 'plausibility' do
804
165
  it_is_correct_for 'Panama (Republic of)', :samples => ['+507 800 1234',
805
166
  '+507 6 123 4567',
806
167
  '+507 2 123 456']
807
- it_is_correct_for 'Papua New Guinea', :samples => ['+675 3 123 567',
808
- '+675 180 1234',
809
- '+675 80 123 456',
810
- '+675 91 123 456',
811
- '+675 16 123 45',
812
- '+675 184 1234 5678',
813
- '+675 170 12',
814
- '+675 189 1',
815
- '+675 270 1234',
816
- '+675 275 1234',
817
- '+675 279 12',
818
- '+675 115 1234 5678']
819
- it_is_correct_for 'Paraguay (Republic of)', :samples => [['+595 21 123 456', '+595 21 123 4567'],
820
- '+595 345 123 456',
821
- '+595 96 161 1234']
822
- it_is_correct_for 'Qatar', :samples => ['+974 1245 123 456',
823
- '+974 26 134 56',
824
- '+974 33 123 456',
825
- '+974 44 412 456',
826
- '+974 800 12 34',
827
- '+974 900 12 34',
828
- '+974 92 123',
829
- '+974 97 123']
830
168
  it_is_correct_for 'Reunion / Mayotte (new)', :samples => '+262 295 276 964'
831
169
  it_is_correct_for 'Saint Helena', :samples => '+290 5134'
832
170
  it_is_correct_for 'Saint Pierre and Miquelon (Collectivité territoriale de la République française)', :samples => '+508 474 714'