Skip to content

Instantly share code, notes, and snippets.

@aweis

aweis/unit_test.rb

Last active Aug 29, 2015
Embed
What would you like to do?
timestamps weirdness
#s/ActiveSupport::TestCase/Test::Unit::TestCase works
require 'test_helper'
class ThingTest < ActiveSupport::TestCase
def test_thing
ActiveRecord::Base.uncached do
first = ActiveRecord::Base.connection.query("select now();")
p [Time.now, first]
sleep 3
second = ActiveRecord::Base.connection.query("select now();")
p [Time.now, second]
end
end
end
Output
Started
[2015-05-04 22:41:38 -0700, [["2015-05-05 05:41:38.080101+00"]]]
[2015-05-04 22:41:41 -0700, [["2015-05-05 05:41:38.080101+00"]]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment