Skip to content

Commit

Permalink
Do not remove the trunk 0 for San Marino.
Browse files Browse the repository at this point in the history
  • Loading branch information
floere committed Nov 9, 2019
1 parent ef6b4c5 commit a9f24c1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/phony/countries.rb
Original file line number Diff line number Diff line change
Expand Up @@ -731,11 +731,12 @@
# Monaco
#
country '377',
one_of('6') >> split(2,2,2,2) | # mobile
one_of('6') >> split(2,2,2,2) | # mobile
fixed(2) >> split(2,2,2)

# San Marino
country '378',
trunk('', :normalize => false) |
none >> matched_split(
/\A\d{6}\z/ => [3,3],
/\A\d+\z/ => [3,3,4]
Expand Down
10 changes: 9 additions & 1 deletion spec/lib/phony/country_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
end

context 'regression' do
describe 'iceland' do
describe 'Iceland' do
let(:country) do
national_splitter = Phony::NationalSplitters::None.instance_for
local_splitter = Phony::LocalSplitters::Fixed.instance_for [3, 4]
Expand All @@ -35,6 +35,14 @@
country.split('112').should == [nil, false, '112']
end
end
describe 'San Marino' do
it 'normalizes correctly' do
Phony.normalize('+3780549903549').should == '3780549903549'
end
xit 'automatically adds the sole NC' do
Phony.normalize('+378903549').should == '3780549903549'
end
end
end

context "without special cases (with switzerland)" do
Expand Down

0 comments on commit a9f24c1

Please sign in to comment.