Permalink
Browse files

+ Updated Argentina, added El Salvador

  • Loading branch information...
1 parent 6e63426 commit 6c98e4282b3881987165b571e86f4198a52878fd @jcfischer jcfischer committed with Jan 14, 2013
Showing with 13 additions and 3 deletions.
  1. +7 −3 lib/phony/countries.rb
  2. +6 −0 spec/lib/phony/countries_spec.rb
View
@@ -164,8 +164,10 @@
match(/^(22[0137]|237|26[14]|29[179]|34[1235]|35[138]|38[1578])/) >> split(3,4) | # Fixed
match(/^(922[0137]|9237|926[14]|929[179]|934[1235]|935[138]|938[1578])/) >> split(3,4) | # Mobile
match(/^(9\d{4})/) >> split(2,4) | # Mobile
- fixed(4) >> split(2,4) # Fixed
-
+ match(/^([68]\d{2})/) >> split(3,4) | # Service
+ fixed(4) >> split(2,4), # Fixed
+ length(10..11)
+
# Brazil (Federative Republic of).
# http://en.wikipedia.org/wiki/Telephone_numbers_in_Brazil
# country '55' # Brazil, see special file.
@@ -547,7 +549,9 @@
country '500', todo # Falkland Islands (Malvinas)
country '501', todo # Belize
country '502', todo # Guatemala (Republic of)
- country '503', todo # El Salvador (Republic of)
+ # El Salvador (Republic of)
+ country '503', fixed(4) >> split(4,4), length(7..8)
+
country '504', todo # Honduras (Republic of)
country '505', todo # Nicaragua
country '506', todo # Costa Rica
@@ -26,6 +26,7 @@ def self.it_splits number, expected
it_splits '5491112345678', ['54', '911', '1234', '5678']
it_splits '5492201234567', ['54', '9220', '123', '4567']
it_splits '5492221123456', ['54', '92221', '12', '3456']
+ it_splits '548001234567', ['54', '800', '123', '4567']
end
describe 'Austria' do
it_splits '43198110', ['43', '1', '98110'] # Vienna
@@ -312,6 +313,11 @@ def self.it_splits number, expected
it { Phony.split('21611231234').should == ['216', '1', '123', '1234'] } # Ariana
it { Phony.split('21621231234').should == ['216', '2', '123', '1234'] } # Bizerte
end
+ describe 'Salvador (El)' do
+ it { Phony.split('50321121234').should == ['503', '2112', '1234'] } # Fixed number
+ it { Phony.split('50361121234').should == ['503', '6112', '1234'] } # Mobile number
+ end
+
describe 'Singapore' do
it { Phony.split('6561231234').should == ['65', false, '6123', '1234'] } # Fixed line
end

0 comments on commit 6c98e42

Please sign in to comment.