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.
This commit is contained in:
Javi Martín
2019-03-15 20:46:14 +01:00
parent d69adbccb7
commit b3a8924fe0

View File

@@ -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