From fe5b45ed18555cefdcf8a48044f8181ccbb95da5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sun, 22 Sep 2019 23:38:28 +0200 Subject: [PATCH] Remove unnecessary poll creating assignments The factory creating assignments automatically assigns a poll to it, so we don't use the poll for anything else, there's no need to explicitely create it. --- spec/features/budget_polls/officing_spec.rb | 3 +-- spec/models/poll/shift_spec.rb | 6 ++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/spec/features/budget_polls/officing_spec.rb b/spec/features/budget_polls/officing_spec.rb index d9ae81cac..5dab07e05 100644 --- a/spec/features/budget_polls/officing_spec.rb +++ b/spec/features/budget_polls/officing_spec.rb @@ -3,9 +3,8 @@ require "rails_helper" describe "Budget Poll Officing" do scenario "Show sidebar menus if officer has shifts assigned" do - poll = create(:poll) booth = create(:poll_booth) - booth_assignment = create(:poll_booth_assignment, poll: poll, booth: booth) + booth_assignment = create(:poll_booth_assignment, booth: booth) user = create(:user) officer = create(:poll_officer, user: user) diff --git a/spec/models/poll/shift_spec.rb b/spec/models/poll/shift_spec.rb index 5baaede91..539a5f988 100644 --- a/spec/models/poll/shift_spec.rb +++ b/spec/models/poll/shift_spec.rb @@ -57,10 +57,8 @@ describe Poll::Shift do describe "officer_assignments" do it "creates and destroy corresponding officer_assignments" do - poll2 = create(:poll) - - booth_assignment1 = create(:poll_booth_assignment, poll: poll, booth: booth) - booth_assignment2 = create(:poll_booth_assignment, poll: poll2, booth: booth) + booth_assignment1 = create(:poll_booth_assignment, booth: booth) + booth_assignment2 = create(:poll_booth_assignment, booth: booth) expect { create(:poll_shift, booth: booth, officer: officer, date: Date.current) }.to change { Poll::OfficerAssignment.all.count }.by(2)