phone_number_validator 0.2.9 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +1 -0
- data/doc/PhoneNumberValidator.html +2 -6
- data/doc/PhoneNumberValidator/Validator.html +13 -21
- data/doc/PhoneNumberValidatorTest.html +6 -11
- data/doc/README_rdoc.html +1 -0
- data/doc/created.rid +5 -5
- data/doc/index.html +1 -0
- data/doc/js/navigation.js.gz +0 -0
- data/doc/js/search_index.js +1 -1
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js.gz +0 -0
- data/doc/table_of_contents.html +0 -8
- data/lib/phone_number_validator.rb +3 -2
- data/lib/phone_number_validator/validator.rb +11 -12
- data/phone_number_validator.gemspec +1 -1
- data/test/test_phone_number_validator.rb +3 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 982979d5c79d08188740920daaee1a8fd028767219361082f653a0b5b00377bb
|
4
|
+
data.tar.gz: 5f54d1501b80ad5803c67bb0db3094090f32b05d5213dc65eba0e0c1dacd73c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1167d62581a196371af3b0be643f7fdc7153a7e99ab3f3a6dace2707354c2abedc94f3b51cc7097ba15c65244f705f34fbfbee82ab57620bda27b78a0e81160
|
7
|
+
data.tar.gz: f6b5a9296dd5ca25b4aee901c6df5ddbb0bba578f2e60cbe3dde8b3062f837bc6c9dea94455291b9031e215c3fa0ff290da787b04ac954a9940df593d2837595
|
data/README.rdoc
CHANGED
@@ -12,6 +12,7 @@ This gem uses the following regular expression:
|
|
12
12
|
|
13
13
|
# US Phone Numbers
|
14
14
|
/^(?:(?:[2-9]11)|(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:\x20+|#|x\.?|ext\.?|extension)\s*(\d+))?)$/i
|
15
|
+
# Regex Flags: i (ignore case)
|
15
16
|
|
16
17
|
== Installing
|
17
18
|
|
@@ -85,8 +85,6 @@
|
|
85
85
|
|
86
86
|
<section class="description">
|
87
87
|
|
88
|
-
<h1 id="class-PhoneNumberValidator-label-Phone+Number+Validator+Parent+Class">Phone Number Validator Parent Class<span><a href="#class-PhoneNumberValidator-label-Phone+Number+Validator+Parent+Class">¶</a> <a href="#top">↑</a></span></h1>
|
89
|
-
|
90
88
|
<p>This class is the master/parent class to all of the validation
|
91
89
|
functionality</p>
|
92
90
|
|
@@ -124,9 +122,7 @@ functionality</p>
|
|
124
122
|
|
125
123
|
<div class="method-description">
|
126
124
|
|
127
|
-
<
|
128
|
-
|
129
|
-
<p><strong>Example:</strong></p>
|
125
|
+
<p>Validates any United States phone number! <strong>Example:</strong></p>
|
130
126
|
|
131
127
|
<pre class="ruby"><span class="ruby-constant">PhoneNumberValidator</span>.<span class="ruby-identifier">validate_phone_number</span>(<span class="ruby-string">'+1 (949) 355-6244 ext. 198842'</span>)
|
132
128
|
</pre>
|
@@ -144,7 +140,7 @@ functionality</p>
|
|
144
140
|
|
145
141
|
|
146
142
|
<div class="method-source-code" id="validate_phone_number-source">
|
147
|
-
<pre><span class="ruby-comment"># File lib/phone_number_validator.rb, line
|
143
|
+
<pre><span class="ruby-comment"># File lib/phone_number_validator.rb, line 17</span>
|
148
144
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">validate_phone_number</span>(<span class="ruby-identifier">phone_number</span>)
|
149
145
|
<span class="ruby-identifier">validator</span> = <span class="ruby-constant">Validator</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">phone_number</span>)
|
150
146
|
<span class="ruby-identifier">validator</span>.<span class="ruby-identifier">validate_phone_number</span>
|
@@ -87,6 +87,9 @@
|
|
87
87
|
|
88
88
|
<section class="description">
|
89
89
|
|
90
|
+
<p>This class does all of the matching and checking work for the validation of
|
91
|
+
the phone number.</p>
|
92
|
+
|
90
93
|
</section>
|
91
94
|
|
92
95
|
|
@@ -106,19 +109,13 @@
|
|
106
109
|
|
107
110
|
<dt id="PHONE_NUMBER_REGEX">PHONE_NUMBER_REGEX
|
108
111
|
|
109
|
-
<dd><
|
112
|
+
<dd><p>The regex pattern for validating US phone numbers</p>
|
110
113
|
|
111
114
|
<p>Regular Expression tested using <a
|
112
|
-
href="https://regexr.com/">regexr.com</a>
|
113
|
-
Expression:</strong></p>
|
114
|
-
|
115
|
-
<pre class="ruby"><span class="ruby-node">/^(?:(?:[2-9]11)|(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:\x20+|#|x\.?|ext\.?|extension)\s*(\d+))?)$/i</span>
|
116
|
-
</pre>
|
117
|
-
|
118
|
-
<p><strong>RegEx Flags:</strong></p>
|
115
|
+
href="https://regexr.com/">regexr.com</a></p>
|
119
116
|
|
120
|
-
<
|
121
|
-
</
|
117
|
+
<p>The regular expression used can be found in <em>README.rdoc</em> on the
|
118
|
+
documentation's home page</p>
|
122
119
|
|
123
120
|
|
124
121
|
</dl>
|
@@ -147,18 +144,13 @@ Expression:</strong></p>
|
|
147
144
|
|
148
145
|
<div class="method-description">
|
149
146
|
|
150
|
-
<
|
151
|
-
|
152
|
-
<p><strong>Method type:</strong></p>
|
153
|
-
|
154
|
-
<pre class="ruby"><span class="ruby-identifier">constructor</span>
|
155
|
-
</pre>
|
147
|
+
<p>initializes the <strong>@phone_number</strong> instance variable</p>
|
156
148
|
|
157
149
|
|
158
150
|
|
159
151
|
|
160
152
|
<div class="method-source-code" id="new-source">
|
161
|
-
<pre><span class="ruby-comment"># File lib/phone_number_validator/validator.rb, line
|
153
|
+
<pre><span class="ruby-comment"># File lib/phone_number_validator/validator.rb, line 15</span>
|
162
154
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">phone_number</span> = <span class="ruby-string">'+1 (949) 355-6244 ext. 198842'</span>)
|
163
155
|
<span class="ruby-ivar">@phone_number</span> = <span class="ruby-identifier">phone_number</span>
|
164
156
|
<span class="ruby-keyword">end</span></pre>
|
@@ -193,10 +185,10 @@ Expression:</strong></p>
|
|
193
185
|
|
194
186
|
<div class="method-description">
|
195
187
|
|
196
|
-
<
|
188
|
+
<p>Checks to see if the phone number the user entered is valid by testing
|
189
|
+
regex the pattern with the phone number</p>
|
197
190
|
|
198
|
-
<p>
|
199
|
-
regex the pattern with the phone number <strong>Return Type:</strong></p>
|
191
|
+
<p><strong>Return Type:</strong></p>
|
200
192
|
|
201
193
|
<pre class="ruby"><span class="ruby-identifier">boolean</span>
|
202
194
|
</pre>
|
@@ -205,7 +197,7 @@ regex the pattern with the phone number <strong>Return Type:</strong></p>
|
|
205
197
|
|
206
198
|
|
207
199
|
<div class="method-source-code" id="validate_phone_number-source">
|
208
|
-
<pre><span class="ruby-comment"># File lib/phone_number_validator/validator.rb, line
|
200
|
+
<pre><span class="ruby-comment"># File lib/phone_number_validator/validator.rb, line 25</span>
|
209
201
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">validate_phone_number</span>
|
210
202
|
<span class="ruby-keyword">if</span> (<span class="ruby-ivar">@phone_number</span>.<span class="ruby-identifier">match</span>(<span class="ruby-constant">PHONE_NUMBER_REGEX</span>))
|
211
203
|
<span class="ruby-identifier">puts</span> <span class="ruby-string">"'%s' is a valid phone number."</span> <span class="ruby-operator">%</span> <span class="ruby-ivar">@phone_number</span>
|
@@ -87,10 +87,9 @@
|
|
87
87
|
|
88
88
|
<section class="description">
|
89
89
|
|
90
|
-
<
|
90
|
+
<p>This class respresents the testing-unit for this gem app</p>
|
91
91
|
|
92
|
-
<p>
|
93
|
-
from:</strong></p>
|
92
|
+
<p><strong>Inherits from:</strong></p>
|
94
93
|
|
95
94
|
<pre class="ruby"><span class="ruby-constant">Test</span><span class="ruby-operator">::</span><span class="ruby-constant">Unit</span><span class="ruby-operator">::</span><span class="ruby-constant">TestCase</span>
|
96
95
|
</pre>
|
@@ -129,16 +128,14 @@ from:</strong></p>
|
|
129
128
|
|
130
129
|
<div class="method-description">
|
131
130
|
|
132
|
-
<
|
133
|
-
|
134
|
-
<p>Inputs an invalid phone number and expects the output to be
|
131
|
+
<p>This test inputs an invalid phone number and expects the output to be
|
135
132
|
<strong>false</strong></p>
|
136
133
|
|
137
134
|
|
138
135
|
|
139
136
|
|
140
137
|
<div class="method-source-code" id="test_invalid_phone_number-source">
|
141
|
-
<pre><span class="ruby-comment"># File test/test_phone_number_validator.rb, line
|
138
|
+
<pre><span class="ruby-comment"># File test/test_phone_number_validator.rb, line 20</span>
|
142
139
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">test_invalid_phone_number</span>
|
143
140
|
<span class="ruby-identifier">assert_equal</span> <span class="ruby-keyword">false</span>,
|
144
141
|
<span class="ruby-constant">PhoneNumberValidator</span>.<span class="ruby-identifier">validate_phone_number</span>(<span class="ruby-string">'94643823637337'</span>)
|
@@ -166,16 +163,14 @@ from:</strong></p>
|
|
166
163
|
|
167
164
|
<div class="method-description">
|
168
165
|
|
169
|
-
<
|
170
|
-
|
171
|
-
<p>Inputs a valid phone number and expects the output to be
|
166
|
+
<p>This test inputs a valid phone number and expects the output to be
|
172
167
|
<strong>true</strong></p>
|
173
168
|
|
174
169
|
|
175
170
|
|
176
171
|
|
177
172
|
<div class="method-source-code" id="test_valid_phone_number-source">
|
178
|
-
<pre><span class="ruby-comment"># File test/test_phone_number_validator.rb, line
|
173
|
+
<pre><span class="ruby-comment"># File test/test_phone_number_validator.rb, line 13</span>
|
179
174
|
<span class="ruby-keyword">def</span> <span class="ruby-identifier">test_valid_phone_number</span>
|
180
175
|
<span class="ruby-identifier">assert_equal</span> <span class="ruby-keyword">true</span>,
|
181
176
|
<span class="ruby-constant">PhoneNumberValidator</span>.<span class="ruby-identifier">validate_phone_number</span>(<span class="ruby-string">'+1 (949) 355-6244 ext. 198842'</span>)
|
data/doc/README_rdoc.html
CHANGED
@@ -102,6 +102,7 @@ number.</p>
|
|
102
102
|
|
103
103
|
<pre class="ruby"><span class="ruby-comment"># US Phone Numbers</span>
|
104
104
|
<span class="ruby-node">/^(?:(?:[2-9]11)|(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:\x20+|#|x\.?|ext\.?|extension)\s*(\d+))?)$/i</span>
|
105
|
+
<span class="ruby-comment"># Regex Flags: i (ignore case)</span>
|
105
106
|
</pre>
|
106
107
|
|
107
108
|
<h2 id="label-Installing">Installing<span><a href="#label-Installing">¶</a> <a href="#top">↑</a></span></h2>
|
data/doc/created.rid
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
Sun, 04 Nov 2018 18:
|
2
|
-
README.rdoc Sun, 04 Nov 2018
|
3
|
-
lib/phone_number_validator.rb Sun, 04 Nov 2018 18:
|
4
|
-
lib/phone_number_validator/validator.rb Sun, 04 Nov 2018 18:
|
5
|
-
test/test_phone_number_validator.rb Sun, 04 Nov 2018 18:
|
1
|
+
Sun, 04 Nov 2018 18:33:01 -0800
|
2
|
+
README.rdoc Sun, 04 Nov 2018 18:31:11 -0800
|
3
|
+
lib/phone_number_validator.rb Sun, 04 Nov 2018 18:28:49 -0800
|
4
|
+
lib/phone_number_validator/validator.rb Sun, 04 Nov 2018 18:30:16 -0800
|
5
|
+
test/test_phone_number_validator.rb Sun, 04 Nov 2018 18:25:44 -0800
|
6
6
|
bin/phone_number_validator Sun, 04 Nov 2018 18:16:53 -0800
|
data/doc/index.html
CHANGED
@@ -97,6 +97,7 @@ number.</p>
|
|
97
97
|
|
98
98
|
<pre class="ruby"><span class="ruby-comment"># US Phone Numbers</span>
|
99
99
|
<span class="ruby-node">/^(?:(?:[2-9]11)|(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:\x20+|#|x\.?|ext\.?|extension)\s*(\d+))?)$/i</span>
|
100
|
+
<span class="ruby-comment"># Regex Flags: i (ignore case)</span>
|
100
101
|
</pre>
|
101
102
|
|
102
103
|
<h2 id="label-Installing">Installing<span><a href="#label-Installing">¶</a> <a href="#top">↑</a></span></h2>
|
data/doc/js/navigation.js.gz
CHANGED
Binary file
|
data/doc/js/search_index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
var search_data = {"index":{"searchIndex":["phonenumbervalidator","validator","phonenumbervalidatortest","new()","test_invalid_phone_number()","test_valid_phone_number()","validate_phone_number()","validate_phone_number()","readme"],"longSearchIndex":["phonenumbervalidator","phonenumbervalidator::validator","phonenumbervalidatortest","phonenumbervalidator::validator::new()","phonenumbervalidatortest#test_invalid_phone_number()","phonenumbervalidatortest#test_valid_phone_number()","phonenumbervalidator::validate_phone_number()","phonenumbervalidator::validator#validate_phone_number()",""],"info":[["PhoneNumberValidator","","PhoneNumberValidator.html","","<p>
|
1
|
+
var search_data = {"index":{"searchIndex":["phonenumbervalidator","validator","phonenumbervalidatortest","new()","test_invalid_phone_number()","test_valid_phone_number()","validate_phone_number()","validate_phone_number()","readme"],"longSearchIndex":["phonenumbervalidator","phonenumbervalidator::validator","phonenumbervalidatortest","phonenumbervalidator::validator::new()","phonenumbervalidatortest#test_invalid_phone_number()","phonenumbervalidatortest#test_valid_phone_number()","phonenumbervalidator::validate_phone_number()","phonenumbervalidator::validator#validate_phone_number()",""],"info":[["PhoneNumberValidator","","PhoneNumberValidator.html","","<p>This class is the master/parent class to all of the validation\nfunctionality\n"],["PhoneNumberValidator::Validator","","PhoneNumberValidator/Validator.html","","<p>This class does all of the matching and checking work for the validation of\nthe phone number.\n"],["PhoneNumberValidatorTest","","PhoneNumberValidatorTest.html","","<p>This class respresents the testing-unit for this gem app\n<p><strong>Inherits from:</strong>\n\n<pre class=\"ruby\"><span class=\"ruby-constant\">Test</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">Unit</span><span class=\"ruby-operator\">::</span><span class=\"ruby-constant\">TestCase</span>\n</pre>\n"],["new","PhoneNumberValidator::Validator","PhoneNumberValidator/Validator.html#method-c-new","(phone_number = '+1 (949) 355-6244 ext. 198842')","<p>initializes the <strong>@phone_number</strong> instance variable\n"],["test_invalid_phone_number","PhoneNumberValidatorTest","PhoneNumberValidatorTest.html#method-i-test_invalid_phone_number","()","<p>This test inputs an invalid phone number and expects the output to be\n<strong>false</strong>\n"],["test_valid_phone_number","PhoneNumberValidatorTest","PhoneNumberValidatorTest.html#method-i-test_valid_phone_number","()","<p>This test inputs a valid phone number and expects the output to be\n<strong>true</strong>\n"],["validate_phone_number","PhoneNumberValidator","PhoneNumberValidator.html#method-c-validate_phone_number","(phone_number)","<p>Validates any United States phone number! <strong>Example:</strong>\n\n<pre>PhoneNumberValidator.validate_phone_number('+1 (949) ...</pre>\n"],["validate_phone_number","PhoneNumberValidator::Validator","PhoneNumberValidator/Validator.html#method-i-validate_phone_number","()","<p>Checks to see if the phone number the user entered is valid by testing\nregex the pattern with the phone …\n"],["README","","README_rdoc.html","","<p>Phone Number Validator\n<p>About\n<p>This app is a US phone number-validating RubyGem.\n"]]}}
|
data/doc/js/search_index.js.gz
CHANGED
Binary file
|
data/doc/js/searcher.js.gz
CHANGED
Binary file
|
data/doc/table_of_contents.html
CHANGED
@@ -49,20 +49,12 @@
|
|
49
49
|
<ul>
|
50
50
|
<li class="class">
|
51
51
|
<a href="PhoneNumberValidator.html">PhoneNumberValidator</a>
|
52
|
-
|
53
|
-
<ul>
|
54
|
-
<li><a href="PhoneNumberValidator.html#label-Phone+Number+Validator+Parent+Class">Phone Number Validator Parent Class</a>
|
55
|
-
</ul>
|
56
52
|
</li>
|
57
53
|
<li class="class">
|
58
54
|
<a href="PhoneNumberValidator/Validator.html">PhoneNumberValidator::Validator</a>
|
59
55
|
</li>
|
60
56
|
<li class="class">
|
61
57
|
<a href="PhoneNumberValidatorTest.html">PhoneNumberValidatorTest</a>
|
62
|
-
|
63
|
-
<ul>
|
64
|
-
<li><a href="PhoneNumberValidatorTest.html#label-Phone+Number+Validator+Test+Class">Phone Number Validator Test Class</a>
|
65
|
-
</ul>
|
66
58
|
</li>
|
67
59
|
</ul>
|
68
60
|
|
@@ -1,16 +1,17 @@
|
|
1
1
|
##
|
2
|
-
# = Phone Number \Validator Parent Class
|
3
2
|
# This class is the master/parent class to all of the validation functionality
|
4
3
|
class PhoneNumberValidator
|
5
4
|
class << self
|
6
5
|
|
7
6
|
##
|
8
|
-
#
|
7
|
+
# Validates any United States phone number!
|
9
8
|
# <b>Example:</b>
|
10
9
|
# PhoneNumberValidator.validate_phone_number('+1 (949) 355-6244 ext. 198842')
|
10
|
+
#
|
11
11
|
# <b>Output:</b>
|
12
12
|
# => '+1 (949) 355-6244 ext. 198842' is a valid phone number.'
|
13
13
|
# => true
|
14
|
+
#
|
14
15
|
# <b>Arguments:</b>
|
15
16
|
# phone_number: (String)
|
16
17
|
def validate_phone_number(phone_number)
|
@@ -1,28 +1,27 @@
|
|
1
|
+
##
|
2
|
+
# This class does all of the matching and checking work for the validation of the phone number.
|
1
3
|
class PhoneNumberValidator::Validator
|
2
4
|
|
3
5
|
##
|
4
|
-
#
|
6
|
+
# The regex pattern for validating US phone numbers
|
7
|
+
#
|
5
8
|
# Regular Expression tested using {regexr.com}[https://regexr.com/]
|
6
|
-
#
|
7
|
-
#
|
8
|
-
# <b>RegEx Flags:</b>
|
9
|
-
# Regexp::IGNORECASE (i)
|
9
|
+
#
|
10
|
+
# The regular expression used can be found in <em>README.rdoc</em> on the documentation's home page
|
10
11
|
PHONE_NUMBER_REGEX = Regexp.new('^(?:(?:[2-9]11)|(?:(?:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:\x20+|#|x\.?|ext\.?|extension)\s*(\d+))?)$', Regexp::IGNORECASE)
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
# <b>Method type:</b>
|
15
|
-
# constructor
|
13
|
+
##
|
14
|
+
# initializes the <b>@phone_number</b> instance variable
|
16
15
|
def initialize(phone_number = '+1 (949) 355-6244 ext. 198842')
|
17
16
|
@phone_number = phone_number
|
18
17
|
end
|
19
18
|
|
20
19
|
##
|
21
|
-
# == Validation Method
|
22
20
|
# Checks to see if the phone number the user entered is valid
|
23
21
|
# by testing regex the pattern with the phone number
|
24
|
-
|
25
|
-
|
22
|
+
#
|
23
|
+
# <b>Return Type:</b>
|
24
|
+
# boolean
|
26
25
|
def validate_phone_number
|
27
26
|
if (@phone_number.match(PHONE_NUMBER_REGEX))
|
28
27
|
puts "'%s' is a valid phone number." % @phone_number
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = 'phone_number_validator'
|
3
|
-
spec.version = '0.
|
3
|
+
spec.version = '0.3.0'
|
4
4
|
spec.date = Time.now.strftime("%Y-%m-%d")
|
5
5
|
spec.summary = 'Validate any US phone number!'
|
6
6
|
spec.description = 'This gem is a United States phone number validator. This gem uses a complex regular expression that can validate any United States phone number.'
|
@@ -2,23 +2,21 @@ require 'test/unit'
|
|
2
2
|
require 'phone_number_validator'
|
3
3
|
|
4
4
|
##
|
5
|
-
# = Phone Number \Validator Test Class
|
6
5
|
# This class respresents the testing-unit for this gem app
|
6
|
+
#
|
7
7
|
# <b>Inherits from:</b>
|
8
8
|
# Test::Unit::TestCase
|
9
9
|
class PhoneNumberValidatorTest < Test::Unit::TestCase
|
10
10
|
|
11
11
|
##
|
12
|
-
#
|
13
|
-
# Inputs a valid phone number and expects the output to be <b>true</b>
|
12
|
+
# This test inputs a valid phone number and expects the output to be <b>true</b>
|
14
13
|
def test_valid_phone_number
|
15
14
|
assert_equal true,
|
16
15
|
PhoneNumberValidator.validate_phone_number('+1 (949) 355-6244 ext. 198842')
|
17
16
|
end
|
18
17
|
|
19
18
|
##
|
20
|
-
#
|
21
|
-
# Inputs an invalid phone number and expects the output to be <b>false</b>
|
19
|
+
# This test inputs an invalid phone number and expects the output to be <b>false</b>
|
22
20
|
def test_invalid_phone_number
|
23
21
|
assert_equal false,
|
24
22
|
PhoneNumberValidator.validate_phone_number('94643823637337')
|