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

valid? method not working as expected #67

Open
pavan-itd opened this issue Aug 14, 2024 · 1 comment
Open

valid? method not working as expected #67

pavan-itd opened this issue Aug 14, 2024 · 1 comment

Comments

@pavan-itd
Copy link

It should return false if the country code is not correct.

ValidatesZipcode.valid?('Sw1A 2aA', 'UKXXXXX')
# => true
@dgilperez
Copy link
Owner

This is so by design @pavan-itd , because we don't have a validation for all country code. So instead of failing all (potentially right) zipcodes for a country code we don't have support for, we just give it a free pass.

In your case, the country code is obviously wrong, so we may raise a different exception (but I'd be hesitant to do so, at least we should mark that as a breaking change) or maybe return nil instead of false (again, I am not happy about that)

What do you think? Maybe adding a note to the docs? Do you care to open a PR in that case?

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

2 participants