icalendar / icalendar-recurrence

Easy recurrence expansion for iCalendar
MIT License
41 stars 27 forks source link

Failing test #10

Closed espen closed 9 years ago

espen commented 9 years ago

Failures:

1) Icalendar::Recurrence::TimeUtil timezone_offset handles daylight savings Failure/Error: expect(TimeUtil.timezone_offset("America/Los_Angeles", moment: minute_after_clocks_change)).to eq("-08:00")

   expected: "-08:00"
        got: "-07:00"

   (compared using ==)
 # ./spec/lib/time_util_spec.rb:88:in `block (3 levels) in <top (required)>'
jnraine commented 9 years ago

:confounded: oh timezones.

I can't reproduce the issue on my computer. I've tried by running the specs with various timezones as my system default. I'm using ruby 2.1.4p265.

Can you provide any further steps to making these fail? Does the following change to the spec fix the failure on your computer?

diff --git a/spec/lib/time_util_spec.rb b/spec/lib/time_util_spec.rb
index 55da142..e1709f0 100644
--- a/spec/lib/time_util_spec.rb
+++ b/spec/lib/time_util_spec.rb
@@ -81,8 +81,8 @@ describe TimeUtil do

     it "handles daylight savings" do
       # FYI, clocks turn forward an hour on Nov 2 at 9:00:00 UTC
-      minute_before_clocks_change = Time.parse("Nov 2 at 08:59:00 UTC") # on west coast
-      minute_after_clocks_change = Time.parse("Nov 2 at 09:01:00 UTC") # on west coast
+      minute_before_clocks_change = Time.parse("Nov 2 2014 at 08:59:00 UTC") # on west coast
+      minute_after_clocks_change = Time.parse("Nov 2 2014 at 09:01:00 UTC") # on west coast

       expect(TimeUtil.timezone_offset("America/Los_Angeles", moment: minute_before_clocks_change)).to eq("-07:00")
       expect(TimeUtil.timezone_offset("America/Los_Angeles", moment: minute_after_clocks_change)).to eq("-08:00")
espen commented 9 years ago

I'm on CEST using Ruby 2.2.2. Switching to 1.9.3 or 2.1.6 turns tests green.

I recall this from earlier, perhaps it's related to the failing tests: https://byparker.com/blog/2014/ruby-2-2-0-time-parse-localtime-regression/