diff --git a/lib/phony/countries.rb b/lib/phony/countries.rb index 01949608..a35987ca 100644 --- a/lib/phony/countries.rb +++ b/lib/phony/countries.rb @@ -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] diff --git a/spec/lib/phony/country_spec.rb b/spec/lib/phony/country_spec.rb index 7895b52d..460268ce 100644 --- a/spec/lib/phony/country_spec.rb +++ b/spec/lib/phony/country_spec.rb @@ -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] @@ -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