Created
December 20, 2013 18:42
-
-
Save prathamesh-sonpatki/8059372 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
unless File.exist?('Gemfile') | |
File.write('Gemfile', <<-GEMFILE) | |
source 'https://rubygems.org' | |
gem 'rails', '4.0.2' | |
gem 'arel' | |
gem 'pg' | |
GEMFILE | |
system 'bundle' | |
end | |
require 'bundler' | |
Bundler.setup(:default) | |
require 'active_record' | |
require 'minitest/autorun' | |
require 'logger' | |
# This connection will do for database-independent bug reports. | |
ActiveRecord::Base.establish_connection(adapter: 'postgresql', database: 'rails_test') | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
ActiveRecord::Schema.define do | |
create_table :comments do |t| | |
t.timestamp :timestamps, array: true, default: [] | |
t.date :dates, array: true, default: [] | |
end | |
end | |
class Post < ActiveRecord::Base | |
end | |
class BugTest < MiniTest::Unit::TestCase | |
def test_stuff | |
time = Time.now | |
post = Post.create(timestamps: [time], dates: [Date.today]) | |
assert_equal [time], post.timestamps | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment