phonelib 0.2.7 → 0.2.8
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 +7 -0
- data/Rakefile +22 -22
- data/data/PhoneNumberMetaData.xml +486 -373
- data/data/phone_data.dat +0 -0
- data/lib/phonelib/phone.rb +7 -2
- data/lib/phonelib/phone_analyzer.rb +10 -7
- data/lib/phonelib/version.rb +1 -1
- data/lib/tasks/phonelib_tasks.rake +8 -0
- metadata +33 -166
- data/test/dummy/README.rdoc +0 -261
- data/test/dummy/Rakefile +0 -8
- data/test/dummy/app/assets/javascripts/application.js +0 -13
- data/test/dummy/app/assets/javascripts/phones.js +0 -2
- data/test/dummy/app/assets/stylesheets/application.css +0 -13
- data/test/dummy/app/assets/stylesheets/phones.css +0 -4
- data/test/dummy/app/assets/stylesheets/scaffold.css +0 -56
- data/test/dummy/app/controllers/application_controller.rb +0 -3
- data/test/dummy/app/controllers/phones_controller.rb +0 -83
- data/test/dummy/app/helpers/application_helper.rb +0 -2
- data/test/dummy/app/helpers/phones_helper.rb +0 -2
- data/test/dummy/app/models/phone.rb +0 -6
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/app/views/phones/_form.html.erb +0 -25
- data/test/dummy/app/views/phones/edit.html.erb +0 -6
- data/test/dummy/app/views/phones/index.html.erb +0 -25
- data/test/dummy/app/views/phones/new.html.erb +0 -5
- data/test/dummy/app/views/phones/show.html.erb +0 -14
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -59
- data/test/dummy/config/boot.rb +0 -10
- data/test/dummy/config/database.yml +0 -25
- data/test/dummy/config/environment.rb +0 -5
- data/test/dummy/config/environments/development.rb +0 -37
- data/test/dummy/config/environments/production.rb +0 -67
- data/test/dummy/config/environments/test.rb +0 -37
- data/test/dummy/config/initializers/backtrace_silencers.rb +0 -7
- data/test/dummy/config/initializers/inflections.rb +0 -15
- data/test/dummy/config/initializers/mime_types.rb +0 -5
- data/test/dummy/config/initializers/secret_token.rb +0 -7
- data/test/dummy/config/initializers/session_store.rb +0 -8
- data/test/dummy/config/initializers/wrap_parameters.rb +0 -14
- data/test/dummy/config/locales/en.yml +0 -5
- data/test/dummy/config/routes.rb +0 -60
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20130121173847_create_phones.rb +0 -9
- data/test/dummy/db/migrate/20130122075331_add_possible_number_to_phone.rb +0 -5
- data/test/dummy/db/schema.rb +0 -23
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +0 -19
- data/test/dummy/log/test.log +0 -2667
- data/test/dummy/public/404.html +0 -26
- data/test/dummy/public/422.html +0 -26
- data/test/dummy/public/500.html +0 -25
- data/test/dummy/public/favicon.ico +0 -0
- data/test/dummy/script/rails +0 -6
- data/test/dummy/test/fixtures/phones.yml +0 -16
- data/test/dummy/test/functional/phones_controller_test.rb +0 -51
- data/test/dummy/test/unit/helpers/phones_helper_test.rb +0 -4
- data/test/dummy/test/unit/phone_test.rb +0 -47
- data/test/phonelib_test.rb +0 -314
- data/test/test_helper.rb +0 -18
data/test/dummy/public/404.html
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The page you were looking for doesn't exist (404)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/404.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>The page you were looking for doesn't exist.</h1>
|
23
|
-
<p>You may have mistyped the address or the page may have moved.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|
data/test/dummy/public/422.html
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>The change you wanted was rejected (422)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/422.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>The change you wanted was rejected.</h1>
|
23
|
-
<p>Maybe you tried to change something you didn't have access to.</p>
|
24
|
-
</div>
|
25
|
-
</body>
|
26
|
-
</html>
|
data/test/dummy/public/500.html
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>We're sorry, but something went wrong (500)</title>
|
5
|
-
<style type="text/css">
|
6
|
-
body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
|
7
|
-
div.dialog {
|
8
|
-
width: 25em;
|
9
|
-
padding: 0 4em;
|
10
|
-
margin: 4em auto 0 auto;
|
11
|
-
border: 1px solid #ccc;
|
12
|
-
border-right-color: #999;
|
13
|
-
border-bottom-color: #999;
|
14
|
-
}
|
15
|
-
h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
|
16
|
-
</style>
|
17
|
-
</head>
|
18
|
-
|
19
|
-
<body>
|
20
|
-
<!-- This file lives in public/500.html -->
|
21
|
-
<div class="dialog">
|
22
|
-
<h1>We're sorry, but something went wrong.</h1>
|
23
|
-
</div>
|
24
|
-
</body>
|
25
|
-
</html>
|
File without changes
|
data/test/dummy/script/rails
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
3
|
-
|
4
|
-
APP_PATH = File.expand_path('../../config/application', __FILE__)
|
5
|
-
require File.expand_path('../../config/boot', __FILE__)
|
6
|
-
require 'rails/commands'
|
@@ -1,16 +0,0 @@
|
|
1
|
-
valid_and_possible:
|
2
|
-
number: '972541234567'
|
3
|
-
possible_number: '972541234567'
|
4
|
-
|
5
|
-
wrong:
|
6
|
-
number: 'wrong'
|
7
|
-
|
8
|
-
only_valid:
|
9
|
-
number: '972541234567'
|
10
|
-
|
11
|
-
only_possible:
|
12
|
-
possible_number: '972541234567'
|
13
|
-
|
14
|
-
valid_with_bad_possible:
|
15
|
-
number: '972541234567'
|
16
|
-
possible_number: 'wrong'
|
@@ -1,51 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class PhonesControllerTest < ActionController::TestCase
|
4
|
-
|
5
|
-
setup do
|
6
|
-
@phone = phones(:valid_and_possible)
|
7
|
-
Phonelib.default_country = nil
|
8
|
-
end
|
9
|
-
|
10
|
-
test "should get index" do
|
11
|
-
get :index
|
12
|
-
assert_response :success
|
13
|
-
assert_not_nil assigns(:phones)
|
14
|
-
end
|
15
|
-
|
16
|
-
test "should get new" do
|
17
|
-
get :new
|
18
|
-
assert_response :success
|
19
|
-
end
|
20
|
-
|
21
|
-
test "should create phone" do
|
22
|
-
assert_difference('Phone.count') do
|
23
|
-
post :create, phone: { number: @phone.number }
|
24
|
-
end
|
25
|
-
|
26
|
-
assert_redirected_to phone_path(assigns(:phone))
|
27
|
-
end
|
28
|
-
|
29
|
-
test "should show phone" do
|
30
|
-
get :show, id: @phone
|
31
|
-
assert_response :success
|
32
|
-
end
|
33
|
-
|
34
|
-
test "should get edit" do
|
35
|
-
get :edit, id: @phone
|
36
|
-
assert_response :success
|
37
|
-
end
|
38
|
-
|
39
|
-
test "should update phone" do
|
40
|
-
put :update, id: @phone, phone: { number: @phone.number }
|
41
|
-
assert_redirected_to phone_path(assigns(:phone))
|
42
|
-
end
|
43
|
-
|
44
|
-
test "should destroy phone" do
|
45
|
-
assert_difference('Phone.count', -1) do
|
46
|
-
delete :destroy, id: @phone
|
47
|
-
end
|
48
|
-
|
49
|
-
assert_redirected_to phones_path
|
50
|
-
end
|
51
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class PhoneTest < ActiveSupport::TestCase
|
4
|
-
test "saves with valid phone" do
|
5
|
-
phone = Phone.new(number: '972541234567')
|
6
|
-
|
7
|
-
assert phone.save
|
8
|
-
assert phone.errors.empty?
|
9
|
-
end
|
10
|
-
|
11
|
-
test "can't save with invalid phone" do
|
12
|
-
phone = Phone.new(number: 'wrong')
|
13
|
-
|
14
|
-
assert !phone.save
|
15
|
-
assert phone.errors.any?
|
16
|
-
end
|
17
|
-
|
18
|
-
test "valid passes" do
|
19
|
-
phone = phones(:valid_and_possible)
|
20
|
-
assert phone.save
|
21
|
-
assert phone.errors.empty?
|
22
|
-
end
|
23
|
-
|
24
|
-
test "wrong fails" do
|
25
|
-
phone = phones(:wrong)
|
26
|
-
assert !phone.save
|
27
|
-
assert phone.errors.any?
|
28
|
-
end
|
29
|
-
|
30
|
-
test "allow blank passes" do
|
31
|
-
phone = phones(:only_valid)
|
32
|
-
assert phone.save
|
33
|
-
assert phone.errors.empty?
|
34
|
-
end
|
35
|
-
|
36
|
-
test "without allow blank fails" do
|
37
|
-
phone = phones(:only_possible)
|
38
|
-
assert !phone.save
|
39
|
-
assert phone.errors.any?
|
40
|
-
end
|
41
|
-
|
42
|
-
test "wrong possible and not blank fails" do
|
43
|
-
phone = phones(:valid_with_bad_possible)
|
44
|
-
assert !phone.save
|
45
|
-
assert phone.errors.any?
|
46
|
-
end
|
47
|
-
end
|
data/test/phonelib_test.rb
DELETED
@@ -1,314 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class PhonelibTest < Test::Unit::TestCase
|
4
|
-
|
5
|
-
should 'be a Module' do
|
6
|
-
assert_kind_of Module, Phonelib
|
7
|
-
end
|
8
|
-
|
9
|
-
context '.parse' do
|
10
|
-
setup { @phone = Phonelib.parse '9721234567' }
|
11
|
-
|
12
|
-
should 'return a Phone object' do
|
13
|
-
assert @phone.is_a? Phonelib::Phone #instance_of?
|
14
|
-
end
|
15
|
-
|
16
|
-
should 'be possible but not valid phone number' do
|
17
|
-
assert !@phone.valid?
|
18
|
-
assert @phone.possible?
|
19
|
-
end
|
20
|
-
|
21
|
-
context 'with international formatting' do
|
22
|
-
setup { @phone = Phonelib.parse('+1 (972) 123-4567', 'US') }
|
23
|
-
should 'return exact original' do
|
24
|
-
assert_equal '+1 (972) 123-4567', @phone.original
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
context '.valid?' do
|
30
|
-
context 'with malformed phone number' do
|
31
|
-
should 'not be valid' do
|
32
|
-
assert !Phonelib.valid?('sdffsd')
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
context 'with valid phone number' do
|
37
|
-
should 'be valid' do
|
38
|
-
assert Phonelib.valid?('972541234567')
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
context 'with invalid phone number' do
|
43
|
-
should 'not be valid' do
|
44
|
-
assert !Phonelib.valid?('97254123')
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
context '.invalid?' do
|
50
|
-
context 'with malformed phone number' do
|
51
|
-
should 'be valid' do
|
52
|
-
assert Phonelib.invalid?('sdffsd')
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
context 'with valid phone number' do
|
57
|
-
should 'not be valid' do
|
58
|
-
assert !Phonelib.invalid?('972541234567')
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
context 'with invalid phone number' do
|
63
|
-
should 'be valid' do
|
64
|
-
assert Phonelib.invalid?('97254123')
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
context '.possible?' do
|
70
|
-
context 'with valid phone number' do
|
71
|
-
should 'be valid' do
|
72
|
-
assert Phonelib.possible? '972541234567'
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
context 'with invalid phone number' do
|
77
|
-
should 'not be valid' do
|
78
|
-
assert !Phonelib.possible?('97254123')
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
context '.impossible?' do
|
84
|
-
context 'with valid phone number' do
|
85
|
-
should 'not be valid' do
|
86
|
-
assert !Phonelib.impossible?('972541234567')
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|
90
|
-
context 'with invalid phone number' do
|
91
|
-
should 'be valid' do
|
92
|
-
assert Phonelib.impossible?('97254123')
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
context 'valid_for_country?' do
|
98
|
-
context 'with correct data' do
|
99
|
-
['IL', 'il', :il].each do |country|
|
100
|
-
context "with #{country} as country" do
|
101
|
-
should 'be valid' do
|
102
|
-
assert Phonelib.valid_for_country?('972541234567', country)
|
103
|
-
end
|
104
|
-
|
105
|
-
context 'and national number' do
|
106
|
-
should 'be valid' do
|
107
|
-
assert Phonelib.valid_for_country?('0541234567', country)
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
context 'and without prefix' do
|
112
|
-
should 'be valid' do
|
113
|
-
assert Phonelib.valid_for_country?('541234567', country)
|
114
|
-
end
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
['US', 'us', :us].each do |country|
|
121
|
-
context "with #{country} as country" do
|
122
|
-
context 'with incorrect data' do
|
123
|
-
should 'not be valid' do
|
124
|
-
assert !Phonelib.valid_for_country?('972541234567', country)
|
125
|
-
end
|
126
|
-
|
127
|
-
context 'and without prefix' do
|
128
|
-
should 'not be valid' do
|
129
|
-
assert !Phonelib.valid_for_country?('541234567', country)
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
context '.invalid_for_country?' do
|
138
|
-
context 'with correct data' do
|
139
|
-
['IL', 'il', :il].each do |country|
|
140
|
-
context "with #{country} as country" do
|
141
|
-
should 'not be invalid' do
|
142
|
-
assert !Phonelib.invalid_for_country?('972541234567', country)
|
143
|
-
end
|
144
|
-
end
|
145
|
-
end
|
146
|
-
end
|
147
|
-
|
148
|
-
context 'with incorrect data' do
|
149
|
-
['US', 'us', :us].each do |country|
|
150
|
-
context "with #{country} as country" do
|
151
|
-
should 'be invalid' do
|
152
|
-
assert Phonelib.invalid_for_country?('972541234567', country)
|
153
|
-
end
|
154
|
-
end
|
155
|
-
end
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
context '#international' do
|
160
|
-
should 'return right formatting' do
|
161
|
-
phone = Phonelib.parse('972541234567')
|
162
|
-
assert_equal '+972 54-123-4567', phone.international
|
163
|
-
end
|
164
|
-
|
165
|
-
should 'return sanitized when number invalid but possible' do
|
166
|
-
phone = Phonelib.parse('9721234567')
|
167
|
-
assert_equal '+9721234567', phone.international
|
168
|
-
end
|
169
|
-
end
|
170
|
-
|
171
|
-
context '#national' do
|
172
|
-
should 'return right formatting' do
|
173
|
-
phone = Phonelib.parse('972541234567')
|
174
|
-
assert_equal '054-123-4567', phone.national
|
175
|
-
end
|
176
|
-
|
177
|
-
should 'return sanitized national when number invalid but possible' do
|
178
|
-
phone = Phonelib.parse('9721234567')
|
179
|
-
assert_equal '1234567', phone.national
|
180
|
-
end
|
181
|
-
|
182
|
-
should 'return without leading digit for CN number' do
|
183
|
-
phone = Phonelib.parse('18621374266', 'CN')
|
184
|
-
assert_equal '186 2137 4266', phone.national
|
185
|
-
end
|
186
|
-
end
|
187
|
-
|
188
|
-
context 'types' do
|
189
|
-
setup { @phone = Phonelib.parse('972541234567') }
|
190
|
-
should 'return :mobile type' do
|
191
|
-
assert_equal :mobile, @phone.type
|
192
|
-
end
|
193
|
-
|
194
|
-
should 'return Mobile human type' do
|
195
|
-
assert_equal 'Mobile', @phone.human_type
|
196
|
-
end
|
197
|
-
|
198
|
-
should 'return [:mobile] as all types' do
|
199
|
-
assert_equal [:mobile], @phone.types
|
200
|
-
end
|
201
|
-
|
202
|
-
should 'return [Mobile] as all human types' do
|
203
|
-
assert_equal %w(Mobile), @phone.human_types
|
204
|
-
end
|
205
|
-
end
|
206
|
-
|
207
|
-
context 'country' do
|
208
|
-
should 'return IL as country' do
|
209
|
-
phone = Phonelib.parse('972541234567')
|
210
|
-
assert 'IL', phone.country
|
211
|
-
end
|
212
|
-
|
213
|
-
should 'return RU as country' do
|
214
|
-
phone = Phonelib.parse('78005500500')
|
215
|
-
assert 'RU', phone.country
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
context 'default_country' do
|
220
|
-
should 'be invalid with no default country set' do
|
221
|
-
phone = Phonelib.parse('541234567')
|
222
|
-
assert !phone.valid?
|
223
|
-
end
|
224
|
-
|
225
|
-
should 'valid with default country set' do
|
226
|
-
Phonelib.default_country = :IL
|
227
|
-
phone = Phonelib.parse('541234567')
|
228
|
-
assert phone.valid?
|
229
|
-
end
|
230
|
-
|
231
|
-
should 'valid with wrong default country set' do
|
232
|
-
Phonelib.default_country = :UA
|
233
|
-
phone = Phonelib.parse('972541234567')
|
234
|
-
assert phone.valid?
|
235
|
-
end
|
236
|
-
|
237
|
-
should 'not fail when no phone passed and default country set' do
|
238
|
-
Phonelib.default_country = :UA
|
239
|
-
phone = Phonelib.parse(nil)
|
240
|
-
assert phone.invalid?
|
241
|
-
end
|
242
|
-
|
243
|
-
should 'be valid when number invalid for default country' do
|
244
|
-
Phonelib.default_country = :CN
|
245
|
-
phone = Phonelib.parse('+41 44 668 18 00')
|
246
|
-
assert phone.valid?
|
247
|
-
end
|
248
|
-
end
|
249
|
-
|
250
|
-
context 'issue #16' do
|
251
|
-
should 'parse as LT country' do
|
252
|
-
phone = Phonelib.parse('00370 611 11 111')
|
253
|
-
assert_equal 'LT', phone.country
|
254
|
-
end
|
255
|
-
|
256
|
-
should 'show correct international' do
|
257
|
-
phone = Phonelib.parse('370 611 11 111')
|
258
|
-
assert_equal '+370 611 11111', phone.international
|
259
|
-
end
|
260
|
-
end
|
261
|
-
|
262
|
-
context 'issue #18' do
|
263
|
-
should 'not raise exceptions' do
|
264
|
-
assert_not_nil Phonelib.parse('54932', 'DE').national
|
265
|
-
assert_not_nil Phonelib.parse('33251304029', 'LU').national
|
266
|
-
assert_not_nil Phonelib.parse('61130374', 'AU').national
|
267
|
-
end
|
268
|
-
end
|
269
|
-
|
270
|
-
context 'example numbers' do
|
271
|
-
should 'be valid' do
|
272
|
-
data_file = File.dirname(__FILE__) + '/../data/phone_data.dat'
|
273
|
-
phone_data ||= Marshal.load(File.read(data_file))
|
274
|
-
phone_data.each do |data|
|
275
|
-
country = data[:id]
|
276
|
-
next unless country =~ /[A-Z]{2}/
|
277
|
-
data[:types].each do |type, type_data|
|
278
|
-
next unless Phonelib::Core::TYPES_DESC.keys.include? type
|
279
|
-
next unless type_data[:example_number]
|
280
|
-
number = "#{type_data[:example_number]}"
|
281
|
-
phone = Phonelib.parse(number, country)
|
282
|
-
msg = "Phone #{number} in #{country} of #{type}"
|
283
|
-
|
284
|
-
phone_assertions(phone, type, country, msg)
|
285
|
-
end
|
286
|
-
end
|
287
|
-
end
|
288
|
-
|
289
|
-
def phone_assertions(phone, type, country, msg)
|
290
|
-
assert phone.valid?, "#{msg} not valid"
|
291
|
-
assert !phone.invalid?, "#{msg} not valid"
|
292
|
-
assert phone.possible?, "#{msg} not possible"
|
293
|
-
assert !phone.impossible?, "#{msg} not possible"
|
294
|
-
assert phone.valid_for_country?(country),
|
295
|
-
"#{msg} not valid for country"
|
296
|
-
assert !phone.invalid_for_country?(country),
|
297
|
-
"#{msg} not valid for country"
|
298
|
-
assert phone.national.is_a? String
|
299
|
-
assert phone.national.length > 0
|
300
|
-
assert phone.international.is_a? String
|
301
|
-
assert phone.international.length > 0
|
302
|
-
|
303
|
-
assert_equal phone.country, country, "#{msg} wrong country "
|
304
|
-
if phone.type == Phonelib::Core::FIXED_OR_MOBILE
|
305
|
-
assert_contains [Phonelib::Core::FIXED_LINE, Phonelib::Core::MOBILE],
|
306
|
-
type,
|
307
|
-
"#{msg} wrong type #{phone.types}"
|
308
|
-
else
|
309
|
-
assert_contains phone.types, type,
|
310
|
-
"#{msg} wrong type #{phone.types}"
|
311
|
-
end
|
312
|
-
end
|
313
|
-
end
|
314
|
-
end
|