phonelib icon indicating copy to clipboard operation
phonelib copied to clipboard

Changed bahavior upgrading from 0.8.0 to 0.8.1

Open tilo opened this issue 1 year ago • 1 comments

looks like the API for PhoneLib changed from version 0.8.0 to 0.8.1

before you could do this:

phone = Phonelib.parse(phone_number, ["US", "CA"])

now you have to do this:

phone = nil
phone ||= Phonelib.parse(phone_number, "US")
phone ||= Phonelib.parse(phone_number, "CA")
  • such a change in behavior should be caught by failing tests in PhoneLib -> there was no test coverage
  • any change in behavior should rev-up more than just the last digit of the version -> see https://semver.org/

tilo avatar Mar 23 '24 18:03 tilo

@daddyz did you see this?

tilo avatar Jun 27 '24 03:06 tilo

@tilo interesting undocumented behavior. I never saw that method being used like that, it's not documented and not tested. I tried it locally on 0.8.9 and it works. Can you specify your ruby version?

daddyz avatar Jul 17 '24 04:07 daddyz

@tilo interesting undocumented behavior. I never saw that method being used like that, it's not documented and not tested. I tried it locally on 0.8.9 and it works. Can you specify your ruby version?

@daddyz we're using Ruby 3.2.2

tilo avatar Jul 17 '24 05:07 tilo

@tilo can you test latest version?

daddyz avatar Jul 17 '24 05:07 daddyz

regardless, there is a configuration option that allows several countries:

Phonelib.default_country = ['US', 'CA']
phone = Phonelib.parse(phone_number)

daddyz avatar Jul 17 '24 05:07 daddyz

@tilo check version 0.9.1, I saw this happening for possible numbers only, with valid numbers it was working properly

daddyz avatar Jul 17 '24 06:07 daddyz

looks like our tests are passing with 0.9.1

tilo avatar Jul 24 '24 13:07 tilo

great, closing the issue

daddyz avatar Jul 25 '24 04:07 daddyz