timecop
timecop copied to clipboard
Timecop.freeze(1.month.from_now) is broken under certain circumstances with TravisCI environment
This is strange. On Travis CI, Timecop breaks under very peculiar circumstances.
Consider the following code:
On my local machine, I get the following time values
Timecop.freeze("2015-03-01")
=> 2015-03-01 00:00:00 -0800
Timecop.freeze(1.month.from_now)
=> 2015-04-01 00:00:00 -0700
On Travis CI vm:
Timecop.freeze("2015-03-01")
=> 2015-03-01 00:00:00 +0000
Timecop.freeze(1.month.from_now)
=> 2015-03-28 23:00:00 +0000 # WEIRD!
But then if it you do it this way, it works:
Timecop.freeze("2015-03-01")
=> 2015-03-01 00:00:00 +0000
Timecop.freeze(Time.now + 1.month)
=> 2015-04-01 00:00:00 +0000
I'm reporting this to TravisCI as well.
Any ideas why this might be?
Josh here from Travis.
This is a very strange issue indeed.
Have you tried creating a minimal example of this issue in a public repo? If not, it would be very handy as then we can send some PRs to help see if we can find the issue.
Could it be timezone related? Travis uses UTC.
ok, so I set up: https://github.com/synth/travis-timecop and https://travis-ci.org/synth/travis-timecop, but its passing there. So perhaps there is something else in my application that is fudging things around. I will look more at reproducing the issue in this example repo later when I get a bit more time.