From b3a8924fe05fb446b06045b353aa45618b9d63af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 15 Mar 2019 20:46:14 +0100 Subject: [PATCH] Don't create an officer for poll voter factories For web poll voters, it isn't necessary in order to make the record valid, and it adds an extra record to the database for each poll voter created. --- spec/factories/polls.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/factories/polls.rb b/spec/factories/polls.rb index dfe2a7ed3..cf62728d2 100644 --- a/spec/factories/polls.rb +++ b/spec/factories/polls.rb @@ -87,7 +87,6 @@ FactoryBot.define do factory :poll_voter, class: "Poll::Voter" do poll association :user, :level_two - association :officer, factory: :poll_officer from_web trait :from_web do @@ -103,7 +102,9 @@ FactoryBot.define do end officer_assignment do - association :poll_officer_assignment, booth_assignment: booth_assignment, officer: officer + association :poll_officer_assignment, + booth_assignment: booth_assignment, + officer: officer || association(:poll_officer) end end