Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(italian-2ndcs): Fix incorrect constraint of Rome and Milan phone …
…numbers to 8 digits
  • Loading branch information
RhysStansfield committed Jan 19, 2017
1 parent fd8bdc1 commit bbde855
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
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

0 comments on commit bbde855

Please sign in to comment.