joost / phony_rails

This Gem adds useful methods to your Rails app to validate, display and save phone numbers. It uses the super awesome Phony gem (https://github.com/floere/phony).
MIT License
556 stars 111 forks source link

Some German numbers not passing plausible_numbers? without country_code #193

Closed goalaleo closed 5 years ago

goalaleo commented 5 years ago

I generated some German numbers with the FFaker gem, and some generated numbers fail the PhonyRails.plausible_number? check if the country_code: option is omitted, but pass it when it is provided:

> fails_without_country_code_but_passes_with_it = proc { |number| !PhonyRails.plausible_number?(number) && PhonyRails.plausible_number?(number, country_code: "DE") }

> numbers = 100.times.map { FFaker::PhoneNumberDE.international_mobile_phone_number }

> numbers.select &fails_without_country_code_but_passes_with_it
=> ["+49 152 7513282", "+49 152 1043799", "+49 152 2883145"]
joost commented 5 years ago

Hmm.. can you verify if it is a phony or phony_rails issue?

goalaleo commented 5 years ago

@joost it seems to be a phony issue after all. I'll open an issue there 👍

> numbers.select{ |n| !Phony.plausible?(n) }
=> ["+49 152 7513282", "+49 152 1043799", "+49 152 2883145"]

https://github.com/floere/phony/issues/440

joost commented 5 years ago

👍 closing