Skip to content

Commit

Permalink
+ Moved Chile to main file, - Chile special file, + Spec
Browse files Browse the repository at this point in the history
  • Loading branch information
floere committed May 2, 2011
1 parent 6f14f18 commit 9e4da68
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 19 deletions.
1 change: 0 additions & 1 deletion lib/phony.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
# The ones that need more space to define.
#
require File.expand_path '../phony/countries/austria', __FILE__
require File.expand_path '../phony/countries/chile', __FILE__
require File.expand_path '../phony/countries/china', __FILE__
require File.expand_path '../phony/countries/germany', __FILE__
require File.expand_path '../phony/countries/hungary', __FILE__
Expand Down
6 changes: 5 additions & 1 deletion lib/phony/countries.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,11 @@
# :service? => brazilian_service, :mobile? => ?
# http://en.wikipedia.org/wiki/Telephone_numbers_in_Brazil

# country '56' # Chile, see special file.
# Chile.
#
country '56', match(/^(13[0-79]|14[79])\d+$/) >> split(3,3) | # Service
one_of('2', '9') >> split(8) | # Santiago, Mobile
fixed(2) >> split(8) # 2-digit NDCs

# TODO Colombia.
#
Expand Down
14 changes: 0 additions & 14 deletions lib/phony/countries/chile.rb

This file was deleted.

7 changes: 4 additions & 3 deletions spec/lib/phony/countries_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@
Phony.split('551112341234').should == ['55', '11', '1234', '1234']
end
it 'handles chilean numbers' do
Phony.split('5621234567').should == ['56', '2', '1234567'] # Santiago
Phony.split('5675123456').should == ['56', '75', '123456'] # Curico
Phony.split('56912345678').should == ['56', '9', '12345678'] # mobile
Phony.split('5621234567').should == ['56', '2', '1234567'] # Santiago
Phony.split('5675123456').should == ['56', '75', '123456'] # Curico
Phony.split('56912345678').should == ['56', '9', '12345678'] # Mobile
Phony.split('56137123456').should == ['56', '137', '123', '456'] # Service
end
it 'handles chinese numbers' do
Phony.split('862112345678').should == ['86', '21', '1234', '5678'] # Shanghai
Expand Down

0 comments on commit 9e4da68

Please sign in to comment.