Remove isolated useless assignments
These variables can be considered a block, and so removing them doesn't make the test much harder to undestand. Sometimes these variables formed the setup, sometimes they formed an isolated part of the setup, and sometimes they were the part of the test that made the test different from other tests.
This commit is contained in:
@@ -175,14 +175,15 @@ describe "Admin booths assignments" do
|
||||
poll = create(:poll, starts_at: 2.weeks.ago, ends_at: 1.week.ago)
|
||||
booth = create(:poll_booth)
|
||||
booth_assignment = create(:poll_booth_assignment, poll: poll, booth: booth)
|
||||
officer_assignment_1 = create(:poll_officer_assignment, booth_assignment: booth_assignment, date: poll.starts_at)
|
||||
officer_assignment_2 = create(:poll_officer_assignment, booth_assignment: booth_assignment, date: poll.ends_at)
|
||||
final_officer_assignment = create(:poll_officer_assignment, :final, booth_assignment: booth_assignment, date: poll.ends_at)
|
||||
|
||||
create(:poll_officer_assignment, booth_assignment: booth_assignment, date: poll.starts_at)
|
||||
create(:poll_officer_assignment, booth_assignment: booth_assignment, date: poll.ends_at)
|
||||
create(:poll_officer_assignment, :final, booth_assignment: booth_assignment, date: poll.ends_at)
|
||||
|
||||
create(:poll_voter, poll: poll, booth_assignment: booth_assignment, created_at: poll.starts_at.to_date)
|
||||
create(:poll_voter, poll: poll, booth_assignment: booth_assignment, created_at: poll.ends_at.to_date)
|
||||
|
||||
booth_assignment_2 = create(:poll_booth_assignment, poll: poll)
|
||||
create(:poll_booth_assignment, poll: poll)
|
||||
|
||||
visit admin_poll_path(poll)
|
||||
click_link "Booths (2)"
|
||||
|
||||
@@ -13,8 +13,8 @@ describe "Admin shifts" do
|
||||
booth1 = create(:poll_booth)
|
||||
booth2 = create(:poll_booth)
|
||||
|
||||
shift1 = create(:poll_shift, officer: officer, booth: booth1, date: Date.current)
|
||||
shift2 = create(:poll_shift, officer: officer, booth: booth2, date: Time.zone.tomorrow)
|
||||
create(:poll_shift, officer: officer, booth: booth1, date: Date.current)
|
||||
create(:poll_shift, officer: officer, booth: booth2, date: Time.zone.tomorrow)
|
||||
|
||||
visit new_admin_booth_shift_path(booth1)
|
||||
|
||||
@@ -99,8 +99,8 @@ describe "Admin shifts" do
|
||||
booth = create(:poll_booth, polls: [poll])
|
||||
officer = create(:poll_officer)
|
||||
|
||||
shift1 = create(:poll_shift, :vote_collection_task, officer: officer, booth: booth, date: Date.current)
|
||||
shift2 = create(:poll_shift, :recount_scrutiny_task, officer: officer, booth: booth, date: Time.zone.tomorrow)
|
||||
create(:poll_shift, :vote_collection_task, officer: officer, booth: booth, date: Date.current)
|
||||
create(:poll_shift, :recount_scrutiny_task, officer: officer, booth: booth, date: Time.zone.tomorrow)
|
||||
|
||||
vote_collection_dates = (Date.current..poll.ends_at.to_date).to_a
|
||||
.reject { |date| date == Date.current }
|
||||
@@ -243,7 +243,7 @@ describe "Admin shifts" do
|
||||
booth = create(:poll_booth)
|
||||
officer = create(:poll_officer)
|
||||
|
||||
shift = create(:poll_shift, officer: officer, booth: booth)
|
||||
create(:poll_shift, officer: officer, booth: booth)
|
||||
officer.destroy
|
||||
|
||||
visit new_admin_booth_shift_path(booth)
|
||||
|
||||
Reference in New Issue
Block a user