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 FactoryBot.define do
factory(:forum_post) do factory(:forum_post) do
creator creator
topic factory: :forum_topic
body {FFaker::Lorem.sentences.join(" ")} body {FFaker::Lorem.sentences.join(" ")}
end end
end end

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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