Add and apply FactoryBot/AssociationStyle rule
This rule was added in rubocop-factory_bot 2.23.0. We were following it sometimes, and sometimes we were not.
This commit is contained in:
@@ -32,6 +32,9 @@ Capybara/SpecificActions:
|
|||||||
Capybara/VisibilityMatcher:
|
Capybara/VisibilityMatcher:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
FactoryBot/AssociationStyle:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
FactoryBot/ConsistentParenthesesStyle:
|
FactoryBot/ConsistentParenthesesStyle:
|
||||||
Enabled: true
|
Enabled: true
|
||||||
|
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ FactoryBot.define do
|
|||||||
end
|
end
|
||||||
|
|
||||||
factory :banner_section, class: "Banner::Section" do
|
factory :banner_section, class: "Banner::Section" do
|
||||||
association :banner_id, factory: :banner
|
banner_id factory: :banner
|
||||||
association :web_section
|
web_section
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :site_customization_page, class: "SiteCustomization::Page" do
|
factory :site_customization_page, class: "SiteCustomization::Page" do
|
||||||
@@ -83,7 +83,7 @@ FactoryBot.define do
|
|||||||
end
|
end
|
||||||
|
|
||||||
trait :budget_investment_map_location do
|
trait :budget_investment_map_location do
|
||||||
association :investment, factory: :budget_investment
|
investment factory: :budget_investment
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ FactoryBot.define do
|
|||||||
sequence(:name) { |n| "Group #{n}" }
|
sequence(:name) { |n| "Group #{n}" }
|
||||||
|
|
||||||
trait :drafting_budget do
|
trait :drafting_budget do
|
||||||
association :budget, factory: [:budget, :drafting]
|
budget factory: [:budget, :drafting]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ FactoryBot.define do
|
|||||||
group { association :budget_group, budget: budget || association(:budget) }
|
group { association :budget_group, budget: budget || association(:budget) }
|
||||||
|
|
||||||
trait :drafting_budget do
|
trait :drafting_budget do
|
||||||
association :group, factory: [:budget_group, :drafting_budget]
|
group factory: [:budget_group, :drafting_budget]
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :with_investment_with_milestone do
|
trait :with_investment_with_milestone do
|
||||||
@@ -113,7 +113,7 @@ FactoryBot.define do
|
|||||||
sequence(:title) { |n| "Budget Investment #{n} title" }
|
sequence(:title) { |n| "Budget Investment #{n} title" }
|
||||||
heading { budget&.headings&.reload&.sample || association(:budget_heading, budget: budget) }
|
heading { budget&.headings&.reload&.sample || association(:budget_heading, budget: budget) }
|
||||||
|
|
||||||
association :author, factory: :user
|
author factory: :user
|
||||||
description { "Spend money on this" }
|
description { "Spend money on this" }
|
||||||
price { 10 }
|
price { 10 }
|
||||||
unfeasibility_explanation { "" }
|
unfeasibility_explanation { "" }
|
||||||
@@ -251,7 +251,7 @@ FactoryBot.define do
|
|||||||
end
|
end
|
||||||
|
|
||||||
factory :budget_ballot, class: "Budget::Ballot" do
|
factory :budget_ballot, class: "Budget::Ballot" do
|
||||||
association :user
|
user
|
||||||
budget
|
budget
|
||||||
|
|
||||||
transient { investments { [] } }
|
transient { investments { [] } }
|
||||||
@@ -264,7 +264,7 @@ FactoryBot.define do
|
|||||||
end
|
end
|
||||||
|
|
||||||
factory :budget_ballot_line, class: "Budget::Ballot::Line" do
|
factory :budget_ballot_line, class: "Budget::Ballot::Line" do
|
||||||
association :investment, factory: :budget_investment
|
investment factory: :budget_investment
|
||||||
|
|
||||||
transient { user { nil } }
|
transient { user { nil } }
|
||||||
|
|
||||||
@@ -275,7 +275,7 @@ FactoryBot.define do
|
|||||||
|
|
||||||
factory :budget_reclassified_vote, class: "Budget::ReclassifiedVote" do
|
factory :budget_reclassified_vote, class: "Budget::ReclassifiedVote" do
|
||||||
user
|
user
|
||||||
association :investment, factory: :budget_investment
|
investment factory: :budget_investment
|
||||||
reason { "unfeasible" }
|
reason { "unfeasible" }
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -284,7 +284,7 @@ FactoryBot.define do
|
|||||||
end
|
end
|
||||||
|
|
||||||
factory :heading_content_block, class: "Budget::ContentBlock" do
|
factory :heading_content_block, class: "Budget::ContentBlock" do
|
||||||
association :heading, factory: :budget_heading
|
heading factory: :budget_heading
|
||||||
locale { "en" }
|
locale { "en" }
|
||||||
body { "Some heading contents" }
|
body { "Some heading contents" }
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -21,14 +21,14 @@ FactoryBot.define do
|
|||||||
|
|
||||||
factory :tagging do
|
factory :tagging do
|
||||||
context { "tags" }
|
context { "tags" }
|
||||||
association :taggable, factory: :proposal
|
taggable factory: :proposal
|
||||||
tag
|
tag
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :topic do
|
factory :topic do
|
||||||
sequence(:title) { |n| "Topic title #{n}" }
|
sequence(:title) { |n| "Topic title #{n}" }
|
||||||
sequence(:description) { |n| "Description as comment #{n}" }
|
sequence(:description) { |n| "Description as comment #{n}" }
|
||||||
association :author, factory: :user
|
author factory: :user
|
||||||
|
|
||||||
trait :with_community do
|
trait :with_community do
|
||||||
community { create(:proposal).community }
|
community { create(:proposal).community }
|
||||||
@@ -38,18 +38,18 @@ FactoryBot.define do
|
|||||||
end
|
end
|
||||||
|
|
||||||
factory :related_content do
|
factory :related_content do
|
||||||
association :author, factory: :user
|
author factory: :user
|
||||||
association :parent_relationable, factory: [:proposal, :debate].sample
|
parent_relationable factory: [:proposal, :debate].sample
|
||||||
association :child_relationable, factory: [:proposal, :debate].sample
|
child_relationable factory: [:proposal, :debate].sample
|
||||||
|
|
||||||
trait :proposals do
|
trait :proposals do
|
||||||
association :parent_relationable, factory: :proposal
|
parent_relationable factory: :proposal
|
||||||
association :child_relationable, factory: :proposal
|
child_relationable factory: :proposal
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :budget_investments do
|
trait :budget_investments do
|
||||||
association :parent_relationable, factory: :budget_investment
|
parent_relationable factory: :budget_investment
|
||||||
association :child_relationable, factory: :budget_investment
|
child_relationable factory: :budget_investment
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :from_machine_learning do
|
trait :from_machine_learning do
|
||||||
@@ -58,7 +58,7 @@ FactoryBot.define do
|
|||||||
end
|
end
|
||||||
|
|
||||||
factory :related_content_score do
|
factory :related_content_score do
|
||||||
association :user
|
user
|
||||||
association :related_content
|
related_content
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
FactoryBot.define do
|
FactoryBot.define do
|
||||||
factory :comment do
|
factory :comment do
|
||||||
association :commentable, factory: :debate
|
commentable factory: :debate
|
||||||
user
|
user
|
||||||
sequence(:body) { |n| "Comment body #{n}" }
|
sequence(:body) { |n| "Comment body #{n}" }
|
||||||
|
|
||||||
%i[budget_investment debate legislation_annotation legislation_question legislation_proposal
|
%i[budget_investment debate legislation_annotation legislation_question legislation_proposal
|
||||||
poll proposal topic_with_community].each do |model|
|
poll proposal topic_with_community].each do |model|
|
||||||
factory :"#{model}_comment" do
|
factory :"#{model}_comment" do
|
||||||
association :commentable, factory: model
|
commentable factory: model
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ FactoryBot.define do
|
|||||||
|
|
||||||
trait :valuation do
|
trait :valuation do
|
||||||
valuation { true }
|
valuation { true }
|
||||||
association :commentable, factory: :budget_investment
|
commentable factory: :budget_investment
|
||||||
before :create do |valuation|
|
before :create do |valuation|
|
||||||
valuator = create(:valuator)
|
valuator = create(:valuator)
|
||||||
valuation.author = valuator.user
|
valuation.author = valuator.user
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ FactoryBot.define do
|
|||||||
sequence(:title) { |n| "Debate #{n} title" }
|
sequence(:title) { |n| "Debate #{n} title" }
|
||||||
description { "Debate description" }
|
description { "Debate description" }
|
||||||
terms_of_service { "1" }
|
terms_of_service { "1" }
|
||||||
association :author, factory: :user
|
author factory: :user
|
||||||
|
|
||||||
trait :hidden do
|
trait :hidden do
|
||||||
hidden_at { Time.current }
|
hidden_at { Time.current }
|
||||||
@@ -46,7 +46,7 @@ FactoryBot.define do
|
|||||||
end
|
end
|
||||||
|
|
||||||
factory :flag do
|
factory :flag do
|
||||||
association :flaggable, factory: :debate
|
flaggable factory: :debate
|
||||||
association :user
|
user
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -2,36 +2,36 @@ FactoryBot.define do
|
|||||||
factory :image do
|
factory :image do
|
||||||
attachment { Rack::Test::UploadedFile.new("spec/fixtures/files/clippy.jpg") }
|
attachment { Rack::Test::UploadedFile.new("spec/fixtures/files/clippy.jpg") }
|
||||||
title { "Lorem ipsum dolor sit amet" }
|
title { "Lorem ipsum dolor sit amet" }
|
||||||
association :user
|
user
|
||||||
|
|
||||||
trait :proposal_image do
|
trait :proposal_image do
|
||||||
association :imageable, factory: :proposal
|
imageable factory: :proposal
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :budget_image do
|
trait :budget_image do
|
||||||
association :imageable, factory: :budget
|
imageable factory: :budget
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :budget_investment_image do
|
trait :budget_investment_image do
|
||||||
association :imageable, factory: :budget_investment
|
imageable factory: :budget_investment
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :document do
|
factory :document do
|
||||||
sequence(:title) { |n| "Document title #{n}" }
|
sequence(:title) { |n| "Document title #{n}" }
|
||||||
association :user
|
user
|
||||||
attachment { Rack::Test::UploadedFile.new("spec/fixtures/files/empty.pdf") }
|
attachment { Rack::Test::UploadedFile.new("spec/fixtures/files/empty.pdf") }
|
||||||
|
|
||||||
trait :proposal_document do
|
trait :proposal_document do
|
||||||
association :documentable, factory: :proposal
|
documentable factory: :proposal
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :budget_investment_document do
|
trait :budget_investment_document do
|
||||||
association :documentable, factory: :budget_investment
|
documentable factory: :budget_investment
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :poll_question_document do
|
trait :poll_question_document do
|
||||||
association :documentable, factory: :poll_question
|
documentable factory: :poll_question
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :admin do
|
trait :admin do
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
FactoryBot.define do
|
FactoryBot.define do
|
||||||
factory :machine_learning_job do
|
factory :machine_learning_job do
|
||||||
association :user
|
user
|
||||||
script { "script.py" }
|
script { "script.py" }
|
||||||
started_at { Time.current }
|
started_at { Time.current }
|
||||||
finished_at { nil }
|
finished_at { nil }
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ FactoryBot.define do
|
|||||||
end
|
end
|
||||||
|
|
||||||
factory :milestone do
|
factory :milestone do
|
||||||
association :milestoneable, factory: :budget_investment
|
milestoneable factory: :budget_investment
|
||||||
association :status, factory: :milestone_status
|
status factory: :milestone_status
|
||||||
sequence(:title) { |n| "Milestone #{n} title" }
|
sequence(:title) { |n| "Milestone #{n} title" }
|
||||||
description { "Milestone description" }
|
description { "Milestone description" }
|
||||||
publication_date { Date.current }
|
publication_date { Date.current }
|
||||||
@@ -25,7 +25,7 @@ FactoryBot.define do
|
|||||||
end
|
end
|
||||||
|
|
||||||
factory :progress_bar do
|
factory :progress_bar do
|
||||||
association :progressable, factory: :budget_investment
|
progressable factory: :budget_investment
|
||||||
percentage { rand(0..100) }
|
percentage { rand(0..100) }
|
||||||
kind { :primary }
|
kind { :primary }
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
FactoryBot.define do
|
FactoryBot.define do
|
||||||
factory :notification do
|
factory :notification do
|
||||||
user
|
user
|
||||||
association :notifiable, factory: :proposal
|
notifiable factory: :proposal
|
||||||
|
|
||||||
trait :read do
|
trait :read do
|
||||||
read_at { Time.current }
|
read_at { Time.current }
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :for_proposal_notification do
|
trait :for_proposal_notification do
|
||||||
association :notifiable, factory: :proposal_notification
|
notifiable factory: :proposal_notification
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :for_comment do
|
trait :for_comment do
|
||||||
association :notifiable, factory: :comment
|
notifiable factory: :comment
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :for_poll_question do
|
trait :for_poll_question do
|
||||||
association :notifiable, factory: :poll_question
|
notifiable factory: :poll_question
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ FactoryBot.define do
|
|||||||
end
|
end
|
||||||
|
|
||||||
trait :for_budget do
|
trait :for_budget do
|
||||||
association :budget
|
budget
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :with_image do
|
trait :with_image do
|
||||||
@@ -49,7 +49,7 @@ FactoryBot.define do
|
|||||||
|
|
||||||
factory :poll_question, class: "Poll::Question" do
|
factory :poll_question, class: "Poll::Question" do
|
||||||
poll
|
poll
|
||||||
association :author, factory: :user
|
author factory: :user
|
||||||
sequence(:title) { |n| "Question title #{n}" }
|
sequence(:title) { |n| "Question title #{n}" }
|
||||||
|
|
||||||
trait :yes_no do
|
trait :yes_no do
|
||||||
@@ -124,11 +124,11 @@ FactoryBot.define do
|
|||||||
|
|
||||||
factory :poll_booth_assignment, class: "Poll::BoothAssignment" do
|
factory :poll_booth_assignment, class: "Poll::BoothAssignment" do
|
||||||
poll
|
poll
|
||||||
association :booth, factory: :poll_booth
|
booth factory: :poll_booth
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :poll_officer_assignment, class: "Poll::OfficerAssignment" do
|
factory :poll_officer_assignment, class: "Poll::OfficerAssignment" do
|
||||||
association :officer, factory: :poll_officer
|
officer factory: :poll_officer
|
||||||
date { Date.current }
|
date { Date.current }
|
||||||
|
|
||||||
transient { poll { association(:poll) } }
|
transient { poll { association(:poll) } }
|
||||||
@@ -144,8 +144,8 @@ FactoryBot.define do
|
|||||||
end
|
end
|
||||||
|
|
||||||
factory :poll_shift, class: "Poll::Shift" do
|
factory :poll_shift, class: "Poll::Shift" do
|
||||||
association :booth, factory: :poll_booth
|
booth factory: :poll_booth
|
||||||
association :officer, factory: :poll_officer
|
officer factory: :poll_officer
|
||||||
date { Date.current }
|
date { Date.current }
|
||||||
|
|
||||||
trait :vote_collection_task do
|
trait :vote_collection_task do
|
||||||
@@ -158,7 +158,7 @@ FactoryBot.define do
|
|||||||
end
|
end
|
||||||
|
|
||||||
factory :poll_voter, class: "Poll::Voter" do
|
factory :poll_voter, class: "Poll::Voter" do
|
||||||
association :user, :level_two
|
user factory: [:user, :level_two]
|
||||||
from_web
|
from_web
|
||||||
|
|
||||||
transient { budget { nil } }
|
transient { budget { nil } }
|
||||||
@@ -196,20 +196,20 @@ FactoryBot.define do
|
|||||||
end
|
end
|
||||||
|
|
||||||
factory :poll_answer, class: "Poll::Answer" do
|
factory :poll_answer, class: "Poll::Answer" do
|
||||||
association :question, factory: [:poll_question, :yes_no]
|
question factory: [:poll_question, :yes_no]
|
||||||
association :author, factory: [:user, :level_two]
|
author factory: [:user, :level_two]
|
||||||
answer { question.question_answers.sample.title }
|
answer { question.question_answers.sample.title }
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :poll_partial_result, class: "Poll::PartialResult" do
|
factory :poll_partial_result, class: "Poll::PartialResult" do
|
||||||
association :question, factory: [:poll_question, :yes_no]
|
question factory: [:poll_question, :yes_no]
|
||||||
association :author, factory: :user
|
author factory: :user
|
||||||
origin { "web" }
|
origin { "web" }
|
||||||
answer { question.question_answers.sample.title }
|
answer { question.question_answers.sample.title }
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :poll_recount, class: "Poll::Recount" do
|
factory :poll_recount, class: "Poll::Recount" do
|
||||||
association :author, factory: :user
|
author factory: :user
|
||||||
origin { "web" }
|
origin { "web" }
|
||||||
|
|
||||||
trait :from_booth do
|
trait :from_booth do
|
||||||
@@ -224,19 +224,19 @@ FactoryBot.define do
|
|||||||
end
|
end
|
||||||
|
|
||||||
factory :poll_ballot_sheet, class: "Poll::BallotSheet" do
|
factory :poll_ballot_sheet, class: "Poll::BallotSheet" do
|
||||||
association :poll
|
poll
|
||||||
association :officer_assignment, factory: :poll_officer_assignment
|
officer_assignment factory: :poll_officer_assignment
|
||||||
data { "1234;9876;5678\n1000;2000;3000;9999" }
|
data { "1234;9876;5678\n1000;2000;3000;9999" }
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :poll_ballot, class: "Poll::Ballot" do
|
factory :poll_ballot, class: "Poll::Ballot" do
|
||||||
association :ballot_sheet, factory: :poll_ballot_sheet
|
ballot_sheet factory: :poll_ballot_sheet
|
||||||
data { "1,2,3" }
|
data { "1,2,3" }
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :officing_residence, class: "Officing::Residence" do
|
factory :officing_residence, class: "Officing::Residence" do
|
||||||
user
|
user
|
||||||
association :officer, factory: :poll_officer
|
officer factory: :poll_officer
|
||||||
document_number
|
document_number
|
||||||
document_type { "1" }
|
document_type { "1" }
|
||||||
year_of_birth { "1980" }
|
year_of_birth { "1980" }
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ FactoryBot.define do
|
|||||||
terms_of_service { "1" }
|
terms_of_service { "1" }
|
||||||
published_at { Time.current }
|
published_at { Time.current }
|
||||||
|
|
||||||
association :author, factory: :user
|
author factory: :user
|
||||||
|
|
||||||
trait :hidden do
|
trait :hidden do
|
||||||
hidden_at { Time.current }
|
hidden_at { Time.current }
|
||||||
@@ -96,7 +96,7 @@ FactoryBot.define do
|
|||||||
sequence(:title) { |n| "Thank you for supporting my proposal #{n}" }
|
sequence(:title) { |n| "Thank you for supporting my proposal #{n}" }
|
||||||
sequence(:body) { |n| "Please let others know so we can make it happen #{n}" }
|
sequence(:body) { |n| "Please let others know so we can make it happen #{n}" }
|
||||||
proposal
|
proposal
|
||||||
association :author, factory: :user
|
author factory: :user
|
||||||
|
|
||||||
trait :moderated do
|
trait :moderated do
|
||||||
moderated { true }
|
moderated { true }
|
||||||
@@ -116,8 +116,8 @@ FactoryBot.define do
|
|||||||
end
|
end
|
||||||
|
|
||||||
factory :signature_sheet do
|
factory :signature_sheet do
|
||||||
association :signable, factory: :proposal
|
signable factory: :proposal
|
||||||
association :author, factory: :user
|
author factory: :user
|
||||||
required_fields_to_verify { "123A, 456B, 789C" }
|
required_fields_to_verify { "123A, 456B, 789C" }
|
||||||
|
|
||||||
trait :with_title do
|
trait :with_title do
|
||||||
@@ -133,7 +133,7 @@ FactoryBot.define do
|
|||||||
factory :activity do
|
factory :activity do
|
||||||
user
|
user
|
||||||
action { "hide" }
|
action { "hide" }
|
||||||
association :actionable, factory: :proposal
|
actionable factory: :proposal
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :dashboard_action, class: "Dashboard::Action" do
|
factory :dashboard_action, class: "Dashboard::Action" do
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
FactoryBot.define do
|
FactoryBot.define do
|
||||||
factory :remote_translation do
|
factory :remote_translation do
|
||||||
association :remote_translatable, factory: :debate
|
remote_translatable factory: :debate
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ FactoryBot.define do
|
|||||||
SDG::Related::RELATABLE_TYPES.map { |relatable_type| relatable_type.downcase.gsub("::", "_") }
|
SDG::Related::RELATABLE_TYPES.map { |relatable_type| relatable_type.downcase.gsub("::", "_") }
|
||||||
.each do |relatable|
|
.each do |relatable|
|
||||||
trait :"#{relatable}_review" do
|
trait :"#{relatable}_review" do
|
||||||
association :relatable, factory: relatable
|
relatable factory: relatable
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -126,21 +126,21 @@ FactoryBot.define do
|
|||||||
end
|
end
|
||||||
|
|
||||||
factory :follow do
|
factory :follow do
|
||||||
association :user
|
user
|
||||||
|
|
||||||
trait :followed_proposal do
|
trait :followed_proposal do
|
||||||
association :followable, factory: :proposal
|
followable factory: :proposal
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :followed_investment do
|
trait :followed_investment do
|
||||||
association :followable, factory: :budget_investment
|
followable factory: :budget_investment
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
factory :direct_message do
|
factory :direct_message do
|
||||||
title { "Hey" }
|
title { "Hey" }
|
||||||
body { "How are You doing?" }
|
body { "How are You doing?" }
|
||||||
association :sender, factory: :user
|
sender factory: :user
|
||||||
association :receiver, factory: :user
|
receiver factory: :user
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,6 +9,6 @@ FactoryBot.define do
|
|||||||
max_votes { 3 }
|
max_votes { 3 }
|
||||||
end
|
end
|
||||||
|
|
||||||
association :questionable, factory: :poll_question
|
questionable factory: :poll_question
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
FactoryBot.define do
|
FactoryBot.define do
|
||||||
factory :vote do
|
factory :vote do
|
||||||
association :votable, factory: :debate
|
votable factory: :debate
|
||||||
association :voter, factory: :user
|
voter factory: :user
|
||||||
vote_flag { true }
|
vote_flag { true }
|
||||||
after(:create) do |vote, _|
|
after(:create) do |vote, _|
|
||||||
vote.votable.update_cached_votes
|
vote.votable.update_cached_votes
|
||||||
|
|||||||
Reference in New Issue
Block a user