Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX Italian 2ndcs #360

Merged
merged 1 commit into from Jan 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/phony/countries/italy.rb
Expand Up @@ -267,7 +267,7 @@
country '39', trunk('', :normalize => false) |
one_of(*service) >> split(3,3) |
one_of(*mobile) >> split(3,4,-1..1) |
one_of(*ndcs_2digit) >> split(4,4) |
one_of(*ndcs_2digit) >> split(4, 2..4) |
one_of(*ndcs_3digit) >> matched_split(
/^1\d{6}$/ => [7],
/^1\d{7}$/ => [8],
Expand Down
2 changes: 2 additions & 0 deletions qed/plausibility.md
Expand Up @@ -527,6 +527,8 @@ Mobile.

#### Italy

Phony.assert.plausible?('+39 06 1234 45')
Phony.assert.plausible?('+39 06 1234 456')
Phony.assert.plausible?('+39 06 1234 4567')

Phony.refute.plausible?('+39 035 00000')
Expand Down
8 changes: 6 additions & 2 deletions spec/lib/phony/countries_spec.rb
Expand Up @@ -405,8 +405,12 @@ def self.it_splits number, expected
it_splits '3934869528123',['39', '348', '695', '2812', '3'] # Mobile (8-digit subscriber no - new)
it_splits '393357210488', ['39', '335', '721', '0488'] # Mobile
it_splits '393248644272', ['39', '324', '864', '4272'] # Mobile
it_splits '390612341234', ['39', '06', '1234', '1234'] # Roma
it_splits '390288838883', ['39', '02', '8883', '8883'] # Milano
it_splits '3906123412', ['39', '06', '1234', '12'] # Roma 6 digit
it_splits '39061234123', ['39', '06', '1234', '123'] # Roma 7 digit
it_splits '390612341234', ['39', '06', '1234', '1234'] # Roma 8 digit
it_splits '3902888388', ['39', '02', '8883', '88'] # Milano 6 digit
it_splits '39028883888', ['39', '02', '8883', '888'] # Milano 7 digit
it_splits '390288838883', ['39', '02', '8883', '8883'] # Milano 8 digit
it_splits '390141595661', ['39', '0141', '595', '661'] # Asti
it_splits '3903123391', ['39', '031', '23391'] # Como
it_splits '390909709511', ['39', '090', '9709511'] # Barcellona
Expand Down