Created
March 6, 2015 17:19
-
-
Save tenderlove/71176fa23d123e036f1f to your computer and use it in GitHub Desktop.
This file contains 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 'active_record' | |
require 'minitest/autorun' | |
ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:' | |
ActiveRecord::Base.connection.instance_eval do | |
create_table(:users) do |t| | |
t.string :name | |
t.timestamps | |
end | |
end | |
class User < ActiveRecord::Base | |
end | |
Class.new(Minitest::Test) do | |
def test_blah | |
u = User.new | |
t = 1.hour.ago.utc | |
u.name = 'Aaron' | |
u.updated_at = t | |
u.save! | |
u.reload | |
assert_equal t, u.updated_at | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment