You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a daylight savings time error that gets triggered in the to_yaml specs.
The specs in spec/examples/to_yaml_spec.rb all create Schedules using a Ruby time object (Time.new). This object of course doesn't respond to time_zone method, so the time object gets serialized as just a time string that includes the zone offset, rather than as a hash that includes the timezone name (which is what adds DST rule support).
This is easy to see and trigger on the command line. America/Phoenix does not observe DST, but America/New_York does, and is currently in standard time:
$ date
Fri Dec 13 01:52:03 PM EST 2024
$ TZ=America/Phoenix rspec spec/examples/to_yaml_spec.rb:80
Run options: include {:locations=>{"./spec/examples/to_yaml_spec.rb"=>[80]}}
.
Finished in 0.16943 seconds (files took 0.10325 seconds to load)
1 example, 0 failures
$ TZ=America/New_York rspec spec/examples/to_yaml_spec.rb:80
Run options: include {:locations=>{"./spec/examples/to_yaml_spec.rb"=>[80]}}
F
Failures:
1) IceCube::Schedule to_yaml should be able to make a round-trip to YAML with .day_of_year
Failure/Error:
expect(schedule2.first(10).map { |r| r.to_s })
.to eq(schedule1.first(10).map { |r| r.to_s })
expected: ["2025-04-10 13:52:10 -0400", "2025-07-19 13:52:10 -0400", "2026-04-10 13:52:10 -0400", "2026-07-19 1...52:10 -0400", "2028-07-18 13:52:10 -0400", "2029-04-10 13:52:10 -0400", "2029-07-19 13:52:10 -0400"]
got: ["2025-04-10 13:52:10 -0500", "2025-07-19 13:52:10 -0500", "2026-04-10 13:52:10 -0500", "2026-07-19 1...52:10 -0500", "2028-07-18 13:52:10 -0500", "2029-04-10 13:52:10 -0500", "2029-07-19 13:52:10 -0500"]
(compared using ==)
# ./spec/examples/to_yaml_spec.rb:88:in `block (2 levels) in <module:IceCube>'# ./spec/spec_helper.rb:76:in `block (3 levels) in <top (required)>'# ./spec/spec_helper.rb:75:in `block (2 levels) in <top (required)>'
Finished in 0.19318 seconds (files took 0.11404 seconds to load)
1 example, 1 failure
Failed examples:
rspec ./spec/examples/to_yaml_spec.rb:80 # IceCube::Schedule to_yaml should be able to make a round-trip to YAML with .day_of_year
The spec is already requiring activesupport/time, so I propose that we alter the to_yaml_spec.rb specs to use ActiveSupport::TimeWithZone times instead. This will make the specs stop failing half the year when they're run in local timezone that have DST rules.
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
There is a daylight savings time error that gets triggered in the
to_yaml
specs.The specs in
spec/examples/to_yaml_spec.rb
all createSchedule
s using a Ruby time object (Time.new
). This object of course doesn't respond totime_zone
method, so the time object gets serialized as just a time string that includes the zone offset, rather than as a hash that includes the timezone name (which is what adds DST rule support).This is easy to see and trigger on the command line. America/Phoenix does not observe DST, but America/New_York does, and is currently in standard time:
The spec is already requiring
activesupport/time
, so I propose that we alter theto_yaml_spec.rb
specs to use ActiveSupport::TimeWithZone times instead. This will make the specs stop failing half the year when they're run in local timezone that have DST rules.The text was updated successfully, but these errors were encountered: