From d69adbccb70ee6996b1d248d79f8003fb1773bb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Fri, 15 Mar 2019 20:41:26 +0100 Subject: [PATCH] Avoid creating extra poll records in tests The line: create(:poll_voter, booth_assignment: booth_assignment_final_recounted) Creates a new poll for the poll voter. Not only it wastes time by creating new database records, but it doesn't make sense to have a poll voter for a poll which isn't the same as its booth assignment's poll. --- spec/features/admin/poll/polls_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/features/admin/poll/polls_spec.rb b/spec/features/admin/poll/polls_spec.rb index cfc1da4bc..a6c24446e 100644 --- a/spec/features/admin/poll/polls_spec.rb +++ b/spec/features/admin/poll/polls_spec.rb @@ -222,7 +222,9 @@ feature "Admin polls" do total_amount: 21) end - 2.times { create(:poll_voter, booth_assignment: booth_assignment_final_recounted) } + 2.times do + create(:poll_voter, poll: poll, booth_assignment: booth_assignment_final_recounted) + end create(:poll_recount, booth_assignment: booth_assignment_final_recounted,