Skip to content

Instantly share code, notes, and snippets.

@tenderlove
Created October 25, 2012 17:23
Show Gist options
  • Save tenderlove/3954145 to your computer and use it in GitHub Desktop.
Save tenderlove/3954145 to your computer and use it in GitHub Desktop.
require 'minitest/autorun'
require 'date'
class TestDate < MiniTest::Unit::TestCase
def test_date_roundtrip
loop do
dt = DateTime.now
time = dt.to_time
assert_equal format(dt), format(time)
end
end
def format time
time.strftime("%Y-%m-%d %H:%M:%S.%9N %:z")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment