phony 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/countries.rb +369 -368
- data/lib/phony.rb +8 -8
- data/lib/phony/countries/austria.rb +6 -6
- data/lib/phony/countries/belgium.rb +5 -5
- data/lib/phony/countries/chile.rb +4 -3
- data/lib/phony/countries/china.rb +6 -6
- data/lib/phony/countries/egypt.rb +4 -4
- data/lib/phony/countries/germany.rb +5 -5
- data/lib/phony/countries/greece.rb +3 -3
- data/lib/phony/countries/hungary.rb +6 -6
- data/lib/phony/countries/italy.rb +14 -13
- data/lib/phony/countries/malaysia.rb +5 -5
- data/lib/phony/countries/netherlands.rb +5 -3
- data/lib/phony/countries/romania.rb +5 -5
- data/lib/phony/countries/south_korea.rb +5 -5
- data/lib/phony/countries/sweden.rb +4 -2
- data/lib/phony/countries/united_kingdom.rb +10 -8
- data/lib/phony/dsl.rb +40 -30
- data/spec/lib/countries_spec.rb +8 -4
- metadata +2 -6
- data/spec/lib/phony/countries/germany_spec.rb +0 -35
- data/spec/lib/phony/countries/hungary_spec.rb +0 -18
data/spec/lib/countries_spec.rb
CHANGED
@@ -66,10 +66,13 @@ describe 'country descriptions' do
|
|
66
66
|
Phony.split('33112345678').should == ['33', '1', '12','34','56','78']
|
67
67
|
end
|
68
68
|
it "handles german numbers" do
|
69
|
-
Phony.split('
|
70
|
-
Phony.split('
|
71
|
-
Phony.split('
|
72
|
-
Phony.split('
|
69
|
+
Phony.split('493038625454').should == ['49', '30', '386', '25454'] # Berlin
|
70
|
+
Phony.split('4922137683323').should == ['49', '221', '376', '83323'] # Cologne
|
71
|
+
Phony.split('497614767676').should == ['49', '761', '476', '7676'] # Freiburg im Breisgau
|
72
|
+
Phony.split('4921535100').should == ['49', '2153', '510', '0'] # Nettetal-Lobberich
|
73
|
+
Phony.split('493434144602').should == ['49', '34341', '446', '02'] # Geithain
|
74
|
+
Phony.split('491805878323').should == ['49', '180', '587', '8323'] # Service numbers
|
75
|
+
Phony.split('491815878323').should == ['49', '181', '587', '8323'] # Service numbers
|
73
76
|
end
|
74
77
|
it "handles greek numbers" do
|
75
78
|
Phony.split('3021123456').should == ['30', '21', '123456']
|
@@ -78,6 +81,7 @@ describe 'country descriptions' do
|
|
78
81
|
end
|
79
82
|
it "handles hungarian numbers" do
|
80
83
|
Phony.split('3612345678').should == ['36', '1', '234', '5678']
|
84
|
+
Phony.split('3622123456').should == ['36', '22', '123', '456']
|
81
85
|
end
|
82
86
|
it "handles icelandic numbers" do
|
83
87
|
Phony.split('354112').should == ['354', '112'] # Emergency TODO
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: phony
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.3.
|
5
|
+
version: 1.3.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Florian Hanke
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-03-07 00:00:00 +01:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|
@@ -55,8 +55,6 @@ files:
|
|
55
55
|
- lib/phony.rb
|
56
56
|
- README.textile
|
57
57
|
- spec/lib/countries_spec.rb
|
58
|
-
- spec/lib/phony/countries/germany_spec.rb
|
59
|
-
- spec/lib/phony/countries/hungary_spec.rb
|
60
58
|
- spec/lib/phony/country_codes_spec.rb
|
61
59
|
- spec/lib/phony/country_spec.rb
|
62
60
|
- spec/lib/phony/local_splitters/fixed_spec.rb
|
@@ -98,8 +96,6 @@ specification_version: 3
|
|
98
96
|
summary: Fast international phone number (E164 standard) normalizing, splitting and formatting.
|
99
97
|
test_files:
|
100
98
|
- spec/lib/countries_spec.rb
|
101
|
-
- spec/lib/phony/countries/germany_spec.rb
|
102
|
-
- spec/lib/phony/countries/hungary_spec.rb
|
103
99
|
- spec/lib/phony/country_codes_spec.rb
|
104
100
|
- spec/lib/phony/country_spec.rb
|
105
101
|
- spec/lib/phony/local_splitters/fixed_spec.rb
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Phony::Countries::Germany do
|
4
|
-
|
5
|
-
before(:each) do
|
6
|
-
@germany = Phony::Countries::Germany
|
7
|
-
end
|
8
|
-
|
9
|
-
# Note: Many Specs
|
10
|
-
#
|
11
|
-
describe "split" do
|
12
|
-
it "should handle Berlin" do
|
13
|
-
@germany.split('3038625454').should == ['30', '386', '25454']
|
14
|
-
end
|
15
|
-
it "should handle Cologne" do
|
16
|
-
@germany.split('22137683323').should == ['221', '376', '83323']
|
17
|
-
end
|
18
|
-
it "should handle Freiburg im Breisgau" do
|
19
|
-
@germany.split('7614767676').should == ['761', '476', '7676']
|
20
|
-
end
|
21
|
-
it "should handle Nettetal-Lobberich" do
|
22
|
-
@germany.split('21535100').should == ['2153', '510', '0']
|
23
|
-
end
|
24
|
-
it "should handle Geithain" do
|
25
|
-
@germany.split('3434144602').should == ['34341', '446', '02']
|
26
|
-
end
|
27
|
-
it "should handle service numbers with 180 [regression]" do
|
28
|
-
@germany.split('1805878323').should == ['180', '587', '8323']
|
29
|
-
end
|
30
|
-
it "should handle service numbers with 181 [regression]" do
|
31
|
-
@germany.split('1815878323').should == ['181', '587', '8323']
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Phony::Countries::Hungary do
|
4
|
-
|
5
|
-
before(:each) do
|
6
|
-
@hungary = Phony::Countries::Hungary
|
7
|
-
end
|
8
|
-
|
9
|
-
describe "split" do
|
10
|
-
it 'handles Budapest' do
|
11
|
-
@hungary.split('12345678').should == ['1', '234', '5678']
|
12
|
-
end
|
13
|
-
it 'works' do
|
14
|
-
@hungary.split('22123456').should == ['22', '123', '456']
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
end
|