gaffneyc / usps

USPS Webtools API for Ruby
MIT License
63 stars 54 forks source link

Set travis timezone to EST #11

Closed adelevie closed 9 years ago

adelevie commented 9 years ago
  1) USPS::Configuration should have some sensible defaults
     Failure/Error: expect(@config.timeout).to eq(5000)

       expected: 5000
            got: 5

       (compared using ==)
     # ./spec/configuration_spec.rb:11:in `block (2 levels) in <top (required)>'

Just change some hard-coded string/int somewhere?

gaffneyc commented 9 years ago

I pulled in another PR that failed to update the test. Best assumption I have is that Typhoeus changed their timeout API at some point in the last 5 years.

adelevie commented 9 years ago

It's covered here: https://github.com/adelevie/usps/commit/cc630d7ecb2c301ce82d895c4381291a1ce41a12

Just waiting for Travis to finish doing its thing.

gaffneyc commented 9 years ago

While setting the time zone fixes the errors it introduces the issue where code functions differently in different time zones. A common case of this is on the server where the timezone is usually UTC (where your code actually runs) or if someone is using the gem in Pacific, Mountain, or even South African Standard Time.

adelevie commented 9 years ago

Would setting a config variable solve this?

gaffneyc commented 9 years ago

Of the two failing time zone tests I think the first one could be standardized so we're dealing with the time zone properly.

Unfortunately I don't have a good answer for the second case (TrackingDetail) since the API doesn't report a time zone and does not specify if it is in UTC or if it is in the time zone of the address where it was received. We could just treat all times as being in UTC unless a timezone is specified.