From b05ea2964cd575b174656a9cebc6c8aaa8a2bc10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 11 Jan 2019 20:23:46 +0100 Subject: [PATCH] Simplify poll voter factory associations --- spec/factories/polls.rb | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/spec/factories/polls.rb b/spec/factories/polls.rb index 26c047017..e8139e25c 100644 --- a/spec/factories/polls.rb +++ b/spec/factories/polls.rb @@ -91,12 +91,11 @@ FactoryBot.define do origin "web" trait :from_booth do - association :booth_assignment, factory: :poll_booth_assignment origin "booth" - before :create do |voter| - voter.officer_assignment = create(:poll_officer_assignment, - officer: voter.officer, - booth_assignment: voter.booth_assignment) + association :booth_assignment, factory: :poll_booth_assignment + + officer_assignment do + association :poll_officer_assignment, booth_assignment: booth_assignment, officer: officer end end