Skip to content

Instantly share code, notes, and snippets.

@senny
Created May 7, 2013 08:38
Show Gist options
  • Save senny/5531147 to your computer and use it in GitHub Desktop.
Save senny/5531147 to your computer and use it in GitHub Desktop.
require 'active_record'
require 'minitest/autorun'
require 'logger'
# This connection will do for database-independent bug reports.
ActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:')
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Schema.define do
create_table :posts do |t|
t.string :title
end
end
class Post < ActiveRecord::Base
end
class BugTest < MiniTest::Unit::TestCase
def test_stuff
post = Post.new(title: 12345)
post.save!
assert_equal "12345", post.title
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment