Skip to content

Commit

Permalink
Merge pull request #293 from mstanielewicz/patch-1
Browse files Browse the repository at this point in the history
Updates Macedonian rules
  • Loading branch information
floere committed Nov 4, 2015
2 parents 666e6e4 + f3e07ea commit 05e95c4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/phony/countries.rb
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,11 @@

country '387', trunk('0') | fixed(2) >> split(3,2,2) # Bosnia and Herzegovina
country '388', trunk('0') | fixed(2) >> split(3,2,2) # Group of countries, shared code
country '389', trunk('0') | fixed(2) >> split(3,2,2) # The Former Yugoslav Republic of Macedonia

# The Former Yugoslav Republic of Macedonia
country '389',
trunk('0') |
one_of('2','3','4','5','6','7','8') >> split(3,4)

country '420', fixed(3) >> split(3,3) # Czech Republic

Expand Down
3 changes: 3 additions & 0 deletions spec/functional/plausibility_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ def self.it_is_correct_for(country_name, options={})
Phony.plausible?('+231 4 123 456').should be_true
Phony.plausible?('+231 77 123 4567').should be_true
end
it_is_correct_for 'Macedonia', :samples => ['+389 2 123 4567',
'+389 7 124 3456',
'+389 7 234 5678']
it_is_correct_for 'Madagascar', :samples => ['+261 20 012 345 678',
'+261 20 124 3456',
'+261 512 345 678']
Expand Down
7 changes: 7 additions & 0 deletions spec/lib/phony/countries_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,13 @@ def self.it_splits number, expected
it_splits '352370431', ['352', '37', '04', '31']
it_splits '35227855', ['352', '27', '85', '5']
end
describe 'Macedonia' do
it_splits '38921234567', ['389', '2', '123', '4567'] # Skopje
it_splits '38931234567', ['389', '3', '123', '4567'] # Eastern Macedonia
it_splits '38941234567', ['389', '4', '123', '4567'] # Western Macedonia
it_splits '38951234567', ['389', '5', '123', '4567'] # Premium
it_splits '38971234567', ['389', '7', '123', '4567'] # Mobile
end
describe 'Malaysia' do
it_splits '6082123456', ['60', '82', '123456'] # Kuching
it_splits '60312345678', ['60', '3', '12345678'] # Kuala Lumpur
Expand Down

0 comments on commit 05e95c4

Please sign in to comment.