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.
This commit is contained in:
parent
b077450725
commit
149c0d5c2f
|
@ -4,13 +4,25 @@ gemfile(true) do
|
||||||
source "https://rubygems.org"
|
source "https://rubygems.org"
|
||||||
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
||||||
gem "factory_bot", "~> 5.0"
|
gem "factory_bot", "~> 5.0"
|
||||||
|
gem "activerecord"
|
||||||
|
gem "sqlite3"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
require "active_record"
|
||||||
require "factory_bot"
|
require "factory_bot"
|
||||||
require "minitest/autorun"
|
require "minitest/autorun"
|
||||||
|
require "logger"
|
||||||
|
|
||||||
class Post
|
ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:")
|
||||||
attr_accessor :body
|
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
|
end
|
||||||
|
|
||||||
FactoryBot.define do
|
FactoryBot.define do
|
||||||
|
|
Loading…
Reference in New Issue