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.
This commit is contained in:
Javi Martín
2025-03-10 23:05:47 +01:00
parent 6c055f2713
commit d3df20ba88
2 changed files with 5 additions and 2 deletions

View File

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

View File

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