diff --git a/spec/system/admin/poll/booths_spec.rb b/spec/system/admin/poll/booths_spec.rb index eb6cead7e..a930bf9f6 100644 --- a/spec/system/admin/poll/booths_spec.rb +++ b/spec/system/admin/poll/booths_spec.rb @@ -13,7 +13,7 @@ describe "Admin booths", :admin do end scenario "Index" do - 3.times { create(:poll_booth) } + booths = 3.times.map { create(:poll_booth) } visit admin_root_path @@ -22,7 +22,6 @@ describe "Admin booths", :admin do click_link "Booths location" end - booths = Poll::Booth.all booths.each do |booth| within("#booth_#{booth.id}") do expect(page).to have_content booth.name diff --git a/spec/system/admin/poll/polls_spec.rb b/spec/system/admin/poll/polls_spec.rb index afeaaf8da..a677ca0cc 100644 --- a/spec/system/admin/poll/polls_spec.rb +++ b/spec/system/admin/poll/polls_spec.rb @@ -212,6 +212,7 @@ describe "Admin polls", :admin do booth.booth_assignments.each do |booth_assignment| 3.times { create(:poll_officer_assignment, booth_assignment: booth_assignment) } end + officers = Poll::Officer.all visit admin_poll_path(poll) @@ -219,7 +220,6 @@ describe "Admin polls", :admin do expect(page).to have_css ".officer", count: 3 - officers = Poll::Officer.all officers.each do |officer| within("#officer_#{officer.id}") do expect(page).to have_content officer.name