Timecop rspec tests failing

rspec

#1

We have a test that is successful on our dev machines (both mine and a co-worker). It is a DateTime comparison in a timecop block. On circleci, it gives an inexplicable error:

expected: 2016-03-08 03:22:05.693965452 +0000
got: 2016-03-08 03:22:05.693965000 +0000

#2

Also having an identical issue. Was a fix ever found?


#3

#4

I am having a similar issue to the one reported and this fix does not work for me.

If you look at the timestamps in the original question, everything is the same until a quadrillionth of a second where the time is either rounded or truncated and then rest of the significant digits are 0’s. Is there a fix for this problem?


#5

Same here, I freeze time using Timecop.freeze(Time.now.to_i) hoping, I can get rid of the microsecond precision, but this doesn’t work on CircleCI.

Someone on stack overflow mentioned there is a difference how much precision each system has, but this should prevent that since I am setting current time to unix timestamp.


#6

According to this StackOverflow article CircleCI has this to say on the matter:

From what I know, Time.now actually has different precision on OS X and Linux machines. I would suppose that you will get the exact same result on other Linux hosts, but all OS X hosts will give you the result without rounding. I might be wrong, but I recall talking about that with another customer. Mind checking that on a VM or an EC2 instance running Linux?

In the Time reference you can search for precision on the page—the round method can actually adjust the precision for you. Would it be an option for you to round the time in the assertion within the test?


#7

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.