Caused by a change in FactoryBot 5. Associations in factories are now constructed using the same strategy as the base object, meaning that using `build` to construct an object will also construct the associations using `build`. This meant that overriding `create` to do `build` + `save` broke the way that associations were constructed. https://github.com/thoughtbot/factory_bot/blob/master/GETTING_STARTED.md#associations
19 lines
365 B
Ruby
19 lines
365 B
Ruby
FactoryBot.define do
|
|
factory(:post) do
|
|
sequence :md5 do |n|
|
|
n.to_s
|
|
end
|
|
uploader
|
|
uploader_ip_addr {"127.0.0.1"}
|
|
tag_string {"tag1 tag2"}
|
|
tag_count {2}
|
|
tag_count_general {2}
|
|
file_ext {"jpg"}
|
|
image_width {1500}
|
|
image_height {1000}
|
|
file_size {2000}
|
|
rating {"q"}
|
|
source { FFaker::Internet.http_url }
|
|
end
|
|
end
|