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

Croatian number not validating as plausible. #165

Closed
pzupan opened this issue Jun 7, 2017 · 4 comments
Closed

Croatian number not validating as plausible. #165

pzupan opened this issue Jun 7, 2017 · 4 comments

Comments

@pzupan
Copy link

pzupan commented Jun 7, 2017

Phony 2.15.45 properly normalizes and validates this Croatian number:

main:0> Phony.normalize "+385 98 352 085"
=> "38598352085"
main:0> Phony.plausible? "+385 98 352 085"
=> true

But this test fails in phony_rails 0.14.4:

CROATIA_NUMBER_WITH_COUNTRY_CODE = '385 98 352 085'.freeze
context 'when a country code is passed as a symbol' do
      before(:each) do
        @home = SymbolizableHelpfulHome.new
      end

      it "should validate a valid number with the right country code" do
        @home.phone_number = CROATIA_NUMBER_WITH_COUNTRY_CODE
        @home.phone_number_country_code = 'HR'
        expect(@home).to be_valid
      end
end

Note that 385 98 352 0850 [not a valid number] validates as plausible.

@joost
Copy link
Owner

joost commented Jun 7, 2017

@pzupan pull request would be welcome.

@pzupan
Copy link
Author

pzupan commented Jun 8, 2017

Trying to get time to do that...

@davidkovsky
Copy link

I see the same behavior with a Russian number. Phony 2.15.49 says it's plausible. Phony_rails 0.14.6 says it isn't. I'll try to make some time this week to investigate.

@davidkovsky
Copy link

Update: I had forgotten about the interaction between the validator and the country_code column. We have a new use case where those might not match. I'll just make a custom validator that asks Phony.plausible?(number) in order to get around the mismatch.

@joost joost closed this as completed Sep 5, 2018
joost pushed a commit that referenced this issue Sep 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants