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.
This commit is contained in:
Javi Martín
2019-09-22 23:38:28 +02:00
parent 9d627f2db9
commit fe5b45ed18
2 changed files with 3 additions and 6 deletions

View File

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

View File

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