From 149c0d5c2f853aa2fcf18d8eaf8e6a23e82ab434 Mon Sep 17 00:00:00 2001 From: Daniel Colson Date: Fri, 7 Jun 2019 11:34:12 -0400 Subject: [PATCH] Add basic AR setup to reproduction script Many of our bug reports involve interactions between factory_bot and active_record. This will make it easier for people to submit reproduction scripts for those cases. --- .github/REPRODUCTION_SCRIPT.rb | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/REPRODUCTION_SCRIPT.rb b/.github/REPRODUCTION_SCRIPT.rb index 99b638a..39a3b57 100644 --- a/.github/REPRODUCTION_SCRIPT.rb +++ b/.github/REPRODUCTION_SCRIPT.rb @@ -4,13 +4,25 @@ gemfile(true) do source "https://rubygems.org" git_source(:github) { |repo| "https://github.com/#{repo}.git" } gem "factory_bot", "~> 5.0" + gem "activerecord" + gem "sqlite3" end +require "active_record" require "factory_bot" require "minitest/autorun" +require "logger" -class Post - attr_accessor :body +ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:") +ActiveRecord::Base.logger = Logger.new(STDOUT) + +ActiveRecord::Schema.define do + create_table :posts, force: true do |t| + t.string :body + end +end + +class Post < ActiveRecord::Base end FactoryBot.define do