phony 1.7.4 → 1.7.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -40,7 +40,7 @@ module Phony
40
40
 
41
41
  # False if it fails the basic check.
42
42
  #
43
- return false unless (2..15) === normalized.size
43
+ return false unless (4..15) === normalized.size
44
44
 
45
45
  # Hint based checking.
46
46
  #
@@ -51,6 +51,10 @@ module Phony
51
51
  return false unless ndc
52
52
  return false if ndc.empty?
53
53
 
54
+ # A valid range for the rest is 0 or 3+ total digits.
55
+ #
56
+ return false if (1..2) === rest.reduce(0) { |total, string| total + string.size }
57
+
54
58
  # CC.
55
59
  #
56
60
  cc_needed = hints[:cc]
@@ -17,11 +17,21 @@ describe 'validations' do
17
17
  it 'handles small numbers' do
18
18
  Phony.plausible?('353').should be_false
19
19
  end
20
-
21
- it "is correct" do
20
+
21
+ # TODO
22
+ # it 'is correct' do
23
+ # Phony.plausible?('+1911').should be_false
24
+ # end
25
+ it 'is correct' do
26
+ Phony.plausible?('010').should be_false
27
+ end
28
+ it 'is correct' do
29
+ Phony.plausible?("+460000").should be_false
30
+ end
31
+ it 'is correct' do
22
32
  Phony.plausible?('0000000').should be_false
23
33
  end
24
- it "is correct" do
34
+ it 'is correct' do
25
35
  Phony.plausible?('hello').should be_false
26
36
  end
27
37
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phony
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.4
4
+ version: 1.7.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-05 00:00:00.000000000 Z
12
+ date: 2012-07-01 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: ! 'Fast international phone number (E164 standard) normalizing, splitting
15
15
  and formatting. Lots of formatting options: International (+.., 00..), national