Skip to content

Instantly share code, notes, and snippets.

@prathamesh-sonpatki
Created December 20, 2013 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prathamesh-sonpatki/8059372 to your computer and use it in GitHub Desktop.
Save prathamesh-sonpatki/8059372 to your computer and use it in GitHub Desktop.
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