Update test factories to run without input of instances

This commit is contained in:
BrokenEagle
2020-07-19 04:01:26 +00:00
parent e34e7b0d90
commit 40e6c3d77c
8 changed files with 11 additions and 8 deletions

View File

@@ -1,6 +1,7 @@
FactoryBot.define do
factory(:forum_post) do
creator
topic factory: :forum_topic
body {FFaker::Lorem.sentences.join(" ")}
end
end

View File

@@ -2,5 +2,6 @@ FactoryBot.define do
factory(:mod_action) do
creator :factory => :user
description {"1234"}
category {"other"}
end
end

View File

@@ -1,7 +1,7 @@
FactoryBot.define do
factory(:post_disapproval) do
user
post
user factory: :moderator_user
post factory: :post, is_pending: true
reason { PostDisapproval::REASONS.sample }
message { FFaker::Lorem.sentence }
end

View File

@@ -1,6 +1,6 @@
FactoryBot.define do
factory(:post_flag) do
creator
creator factory: :user, created_at: 2.weeks.ago
post
reason {"xxx"}
is_resolved {false}

View File

@@ -1,5 +1,6 @@
FactoryBot.define do
factory(:post_replacement) do
post factory: :post, source: FFaker::Internet.http_url
original_url { FFaker::Internet.http_url }
replacement_url { FFaker::Internet.http_url }
end

View File

@@ -1,6 +1,6 @@
FactoryBot.define do
factory(:post_vote) do
user
user factory: :gold_user
post
score { [-1, 1].sample }
end

View File

@@ -1,8 +1,8 @@
FactoryBot.define do
factory :tag_alias do
creator
antecedent_name {"aaa"}
consequent_name {"bbb"}
antecedent_name {"#{FFaker::Name.first_name.downcase}#{rand(1000)}"}
consequent_name {"#{FFaker::Name.first_name.downcase}#{rand(1000)}"}
status {"active"}
skip_secondary_validations {true}
end

View File

@@ -1,8 +1,8 @@
FactoryBot.define do
factory :tag_implication do
creator
antecedent_name {"aaa"}
consequent_name {"bbb"}
antecedent_name {"#{FFaker::Name.first_name.downcase}#{rand(1000)}"}
consequent_name {"#{FFaker::Name.first_name.downcase}#{rand(1000)}"}
status {"active"}
skip_secondary_validations {true}
end