Created
October 25, 2012 17:23
-
-
Save tenderlove/3954145 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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