Last active
August 29, 2015 13:56
-
-
Save awendt/9112672 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
# Activate the gem you are reporting the issue against. | |
gem 'activerecord', '4.0.2' | |
gem 'activesupport', '4.0.2' | |
require 'active_record' | |
require 'active_support/time_with_zone' | |
require 'minitest/autorun' | |
require 'logger' | |
# Ensure backward compatibility with Minitest 4 | |
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test) | |
# This connection will do for database-independent bug reports. | |
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:') | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
ActiveRecord::Base.default_timezone = :local | |
ActiveRecord::Base.time_zone_aware_attributes = true | |
ActiveRecord::Schema.define do | |
create_table :posts do |t| | |
t.timestamps | |
end | |
end | |
class Post < ActiveRecord::Base | |
end | |
class BugTest < Minitest::Test | |
def test_timestamps | |
post = Post.create! | |
assert_equal 'ActiveSupport::TimeWithZone', post.created_at.class.to_s | |
assert_equal post.to_json, post.reload.to_json | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment