forked from e621ng/e621ng
[Tests] Improve some factories
A forum topic must always contain a forum post, and creating things shouldn't run into throttles. If I want to test that I opt in explicitly.
This commit is contained in:
parent
6561391fe7
commit
ec658c4cb3
@ -1,8 +1,20 @@
|
||||
FactoryBot.define do
|
||||
factory(:forum_topic) do
|
||||
title {FFaker::Lorem.words.join(" ")}
|
||||
title { FFaker::Lorem.words.join(" ") }
|
||||
is_sticky { false }
|
||||
is_locked { false }
|
||||
category_id { Danbooru.config.alias_implication_forum_category }
|
||||
|
||||
transient do
|
||||
body { FFaker::Lorem.sentences.join(" ") }
|
||||
end
|
||||
|
||||
after(:build) do |topic, evaluator|
|
||||
topic.original_post ||= build(:forum_post, topic: topic, body: evaluator.body)
|
||||
end
|
||||
|
||||
before(:create) do |topic, evaluator|
|
||||
topic.original_post ||= build(:forum_post, topic: topic, body: evaluator.body)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,11 +1,11 @@
|
||||
FactoryBot.define do
|
||||
factory(:note) do
|
||||
post
|
||||
post { create(:post) }
|
||||
x { 1 }
|
||||
y { 1 }
|
||||
width { 1 }
|
||||
height { 1 }
|
||||
is_active { true }
|
||||
body {FFaker::Lorem.sentences.join(" ")}
|
||||
body { FFaker::Lorem.sentences.join(" ") }
|
||||
end
|
||||
end
|
||||
|
@ -3,7 +3,7 @@ FactoryBot.define do
|
||||
sequence :md5 do |n|
|
||||
n.to_s
|
||||
end
|
||||
uploader :factory => :user
|
||||
uploader { create(:user, created_at: 2.weeks.ago) }
|
||||
uploader_ip_addr { "127.0.0.1" }
|
||||
tag_string { "tag1 tag2" }
|
||||
tag_count { 2 }
|
||||
|
@ -1,6 +1,7 @@
|
||||
FactoryBot.define do
|
||||
factory(:post_replacement) do
|
||||
creator_ip_addr { "127.0.0.1" }
|
||||
creator { create(:user, created_at: 2.weeks.ago) }
|
||||
replacement_url { FFaker::Internet.http_url }
|
||||
reason { FFaker::Lorem.words.join(" ") }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user