-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
/
REPRODUCTION_SCRIPT.rb
50 lines (40 loc) · 1.21 KB
/
REPRODUCTION_SCRIPT.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
gem "factory_bot", "~> 6.0"
gem "activerecord"
gem "sqlite3"
end
require "active_record"
require "factory_bot"
require "minitest/autorun"
require "logger"
ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:")
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Schema.define do
# TODO: Update the schema to include the specific tables or columns necessary
# to reproduct the bug
create_table :posts, force: true do |t|
t.string :body
end
end
# TODO: Add any application specific code necessary to reproduce the bug
class Post < ActiveRecord::Base
end
FactoryBot.define do
# TODO: Write the factory definitions necessary to reproduce the bug
factory :post do
body { "Post body" }
end
end
class FactoryBotTest < Minitest::Test
def test_factory_bot_stuff
# TODO: Write a failing test case to demonstrate what isn't working as
# expected
body_override = "Body override"
post = FactoryBot.build(:post, body: body_override)
assert_equal post.body, body_override
end
end
# Run the tests with `ruby <filename>`