no_phone 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/no_phone/version.rb +1 -1
- data/spec/validation_spec.rb +10 -10
- metadata +3 -3
data/Gemfile.lock
CHANGED
data/lib/no_phone/version.rb
CHANGED
data/spec/validation_spec.rb
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe NoPhone, "#
|
3
|
+
describe NoPhone, "#number_valid?" do
|
4
4
|
it "is invalid if nil" do
|
5
|
-
NoPhoneWrapper.
|
5
|
+
NoPhoneWrapper.number_valid?(nil).should be_false
|
6
6
|
end
|
7
7
|
|
8
8
|
it "is invalid if blank" do
|
9
|
-
NoPhoneWrapper.
|
9
|
+
NoPhoneWrapper.number_valid?("").should be_false
|
10
10
|
end
|
11
11
|
|
12
12
|
it "is invalid with letters" do
|
13
|
-
NoPhoneWrapper.
|
13
|
+
NoPhoneWrapper.number_valid?("1abc2").should be_false
|
14
14
|
end
|
15
15
|
|
16
16
|
context "with funky characters" do
|
17
17
|
it "rejects parens" do
|
18
|
-
NoPhoneWrapper.
|
18
|
+
NoPhoneWrapper.number_valid?("123(45)678").should be_false
|
19
19
|
end
|
20
20
|
|
21
21
|
it "rejects hyphens" do
|
22
|
-
NoPhoneWrapper.
|
22
|
+
NoPhoneWrapper.number_valid?("123-45-678").should be_false
|
23
23
|
end
|
24
24
|
|
25
25
|
it "rejects periods" do
|
26
|
-
NoPhoneWrapper.
|
26
|
+
NoPhoneWrapper.number_valid?("123.45.678").should be_false
|
27
27
|
end
|
28
28
|
|
29
29
|
it "rejects +sign in the middle" do
|
30
|
-
NoPhoneWrapper.
|
30
|
+
NoPhoneWrapper.number_valid?("123+45+678").should be_false
|
31
31
|
end
|
32
32
|
|
33
33
|
it "accepts spaces" do
|
34
|
-
NoPhoneWrapper.
|
34
|
+
NoPhoneWrapper.number_valid?("123 45 678").should be_true
|
35
35
|
end
|
36
36
|
|
37
37
|
it "accepts +sign in the beginning" do
|
38
|
-
NoPhoneWrapper.
|
38
|
+
NoPhoneWrapper.number_valid?("+123 45 678").should be_true
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 7
|
9
|
+
version: 0.0.7
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Simen Svale Skogsrud, Katrina Owen
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-
|
17
|
+
date: 2011-09-15 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|