From d3df20ba88799bf73f5f67cf53d3fd346b658a1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Mon, 10 Mar 2025 23:05:47 +0100 Subject: [PATCH] Remove call to `visit` in login_through_form_as_officer In most tests calling this method, we were doing another visit right after calling this method, so by removing this `visit` call we're making the tests slightly faster and easier to follow. --- spec/support/common_actions/users.rb | 2 -- spec/system/officing/booth_spec.rb | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/spec/support/common_actions/users.rb b/spec/support/common_actions/users.rb index e94a7fcc3..4b49bd0b2 100644 --- a/spec/support/common_actions/users.rb +++ b/spec/support/common_actions/users.rb @@ -42,8 +42,6 @@ module Users click_button "Enter" expect(page).to have_content "You have been signed in successfully" - - visit new_officing_residence_path end def login_as_manager(manager = create(:manager)) diff --git a/spec/system/officing/booth_spec.rb b/spec/system/officing/booth_spec.rb index cf5b66aaa..010582140 100644 --- a/spec/system/officing/booth_spec.rb +++ b/spec/system/officing/booth_spec.rb @@ -5,6 +5,7 @@ describe "Booth", :with_frozen_time do officer = create(:poll_officer) login_through_form_as_officer(officer.user) + visit new_officing_residence_path expect(page).to have_content "You don't have officing shifts today" end @@ -14,6 +15,7 @@ describe "Booth", :with_frozen_time do create(:poll_officer_assignment, officer: officer, date: Date.current + 1.day) login_through_form_as_officer(officer.user) + visit new_officing_residence_path expect(page).to have_content "You don't have officing shifts today" end @@ -27,6 +29,7 @@ describe "Booth", :with_frozen_time do create(:poll_officer_assignment, officer: officer, poll: poll, booth: booth, date: Date.current) login_through_form_as_officer(officer.user) + visit new_officing_residence_path within("#officing-booth") do expect(page).to have_content "You are officing the booth located at #{booth.location}." @@ -44,6 +47,7 @@ describe "Booth", :with_frozen_time do create(:poll_officer_assignment, officer: officer, poll: poll, booth: booth2, date: Date.current) login_through_form_as_officer(officer.user) + visit new_officing_residence_path expect(page).to have_content "Choose your booth" @@ -69,6 +73,7 @@ describe "Booth", :with_frozen_time do create(:poll_officer_assignment, officer: officer, poll: poll2, booth: booth2, date: Date.current) login_through_form_as_officer(officer.user) + visit new_officing_residence_path expect(page).to have_content "Choose your booth"