timecop
timecop copied to clipboard
Tests fail with tzinfo >= 2.0
1) Error:
TestTimeStackItem#test_timezones_apply_dates:
NoMethodError: undefined method `to_utc' for #<TZInfo::TransitionsTimezonePeriod:0x000055d2eb8052a0>
/usr/local/bundle/gems/activesupport-3.2.22.5/lib/active_support/time_with_zone.rb:57:in `utc'
/usr/local/bundle/gems/activesupport-3.2.22.5/lib/active_support/time_with_zone.rb:77:in `localtime'
/timecop/lib/timecop/time_stack_item.rb:59:in `time'
/timecop/lib/timecop/time_stack_item.rb:129:in `compute_travel_offset'
/timecop/lib/timecop/time_stack_item.rb:14:in `initialize'
/timecop/lib/timecop/timecop.rb:192:in `new'
/timecop/lib/timecop/timecop.rb:192:in `travel'
/timecop/lib/timecop/timecop.rb:129:in `send_travel'
/timecop/lib/timecop/timecop.rb:51:in `freeze'
test/time_stack_item_test.rb:208:in `test_timezones_apply_dates'
2) Error:
TestTimeStackItem#test_timezones_with_parsed_string:
NoMethodError: undefined method `to_local' for #<TZInfo::TransitionsTimezonePeriod:0x000055d2eb83b0a8>
/usr/local/bundle/gems/activesupport-3.2.22.5/lib/active_support/time_with_zone.rb:52:in `time'
/usr/local/bundle/gems/activesupport-3.2.22.5/lib/active_support/time_with_zone.rb:268:in `year'
/usr/local/bundle/gems/activesupport-3.2.22.5/lib/active_support/values/time_zone.rb:276:in `parse'
test/time_stack_item_test.rb:198:in `test_timezones_with_parsed_string'
3) Error:
TestTimeStackItem#test_timezones:
NoMethodError: undefined method `to_local' for #<TZInfo::TransitionsTimezonePeriod:0x000055d2eb8dea00>
/usr/local/bundle/gems/activesupport-3.2.22.5/lib/active_support/time_with_zone.rb:52:in `time'
/usr/local/bundle/gems/activesupport-3.2.22.5/lib/active_support/time_with_zone.rb:268:in `year'
/usr/local/bundle/gems/activesupport-3.2.22.5/lib/active_support/values/time_zone.rb:276:in `parse'
test/time_stack_item_test.rb:189:in `test_timezones'
gem 'tzinfo', '< 2.0.0' no errors
It turns out that raise 4 specifies a version of tzinfo. I'm guessing that rails 3 does not. So this isn't a problem for much of anyone - unless they are still using rails 3 and somehow also tzinfo >=2 - which seems unlikely.
Maybe change the Gemfile so that it specifies tzinfo < 2?
And maybe also update it to activesupport 4-6...