riboseinc / ruby-vobject

Ruby library for parsing vObjects
BSD 2-Clause "Simplified" License
10 stars 3 forks source link

Rspec on Travis raising error with timezones not propagating #4

Closed opoudjis closed 6 years ago

opoudjis commented 6 years ago

Not occurring in local instance of gem:

  1) Vobject should parse iCalendar properly Denver
     Failure/Error: expect(vobj_json).to include_json(exp_json)

                 json atom at path "VCALENDAR/VTIMEZONE/DAYLIGHT/1/RDATE/3/value/0/zone" is not equal to expected value:

                   expected: ""
                        got: "America/Denver"

     # ./spec/vobject_spec.rb:843:in `block (2 levels) in <top (required)>'
opoudjis commented 6 years ago

This is because the last date in the ICS is ambiguous in transition from Daylight to Standard time, and raises an AmbiguousTime exception in the TimeZone class on my machine (which preempts assigning a zone). On Travis, the local time is not recalculated (meaning the exception is raised), but the new time zone is not assigned. I have tried to assign the timezone only as an else to the rescue, but to no avail.

opoudjis commented 6 years ago

Fixed by subtracting an hour, not a minute, from the transitions in question: they were raising an error because on the dot, no UTC time is defined at all:

# Warning: There are local times that have no equivalent UTC times (e.g.
# in the transition from standard time to daylight savings time). There are
# also local times that have more than one UTC equivalent (e.g. in the
# transition from daylight savings time to standard time).
#
# In the first case (no equivalent UTC time), a PeriodNotFound exception
# will be raised.