0

I am enforcing the output of a datetime as Zulu-Time by doing the following

object.updated_at.utc.iso8601 # => "2013-05-12T10:47:01Z"

This works fine for a datetime but when the object is persisting to a database as a timestamp instead I get

"Sun, 12 May 2013 10:47:01 UTC +00:00"

Which is not a Zulu Time string.

I can fix this by

object.updated_at.to_time.utc.iso8601

but I am now trying to unit test this fix, and I can't reproduce the timestamp format to test it.

How do I simulate an SQL timestamp such that .utc.iso8601 returns "Sun, 12 May 2013 10:47:01 UTC +00:00", but without wrapping it in a whole mess of ActiveRecord etc?

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
Dave Sag
  • 13,266
  • 14
  • 86
  • 134

1 Answers1

0

Turned out my problem was me not wearing my glasses and misreading my own test code. I'd close the question except there is no 'closing the question because I forgot my glasses' option.

Dave Sag
  • 13,266
  • 14
  • 86
  • 134
  • 1
    Off-topic: This question was caused by a problem that can no longer be reproduced or a simple typographical error caused by not wearing glasses. :) – Andrew Lavers May 13 '15 at 18:06