Don't check the database for voters in system tests

As mentioned in commits like a586ba806, a7664ad81, 006128da5, b41fbfa52
and c480cdd91, accessing the database after starting the browser with
the `visit` method sometimes results in database corruption and failing
tests on our CI due to the process running the test accessing the
database after the process running the browser has started.

In these cases, there's no need to check the database; we're already
checking the application behavior that shows that the voters have been
correctly created.
This commit is contained in:
Javi Martín
2025-03-13 00:39:28 +01:00
parent 2575fb316b
commit be4cf23a5c
3 changed files with 0 additions and 11 deletions

View File

@@ -18,8 +18,6 @@ module Polls
first(:button, "Confirm vote").click first(:button, "Confirm vote").click
expect(page).to have_content "Vote introduced!" expect(page).to have_content "Vote introduced!"
expect(Poll::Voter.count).to eq(1)
end end
def confirm_phone(code:) def confirm_phone(code:)

View File

@@ -29,9 +29,6 @@ describe "BudgetPolls", :with_frozen_time do
expect(page).to have_content "Vote introduced!" expect(page).to have_content "Vote introduced!"
end end
expect(Poll::Voter.count).to eq(1)
expect(Poll::Voter.first.origin).to eq("booth")
logout logout
login_as(admin.user) login_as(admin.user)
visit admin_poll_recounts_path(poll) visit admin_poll_recounts_path(poll)

View File

@@ -87,9 +87,6 @@ describe "Voter" do
expect(page).to have_content("Vote introduced!") expect(page).to have_content("Vote introduced!")
end end
expect(Poll::Voter.count).to eq(1)
expect(Poll::Voter.first.origin).to eq("booth")
logout logout
login_as(admin.user) login_as(admin.user)
visit admin_poll_recounts_path(poll) visit admin_poll_recounts_path(poll)
@@ -145,7 +142,6 @@ describe "Voter" do
scenario "Trying to vote in web and then in booth" do scenario "Trying to vote in web and then in booth" do
login_as user login_as user
vote_for_poll_via_web(poll, question, "Yes") vote_for_poll_via_web(poll, question, "Yes")
expect(Poll::Voter.count).to eq(1)
logout logout
login_through_form_as_officer(officer) login_through_form_as_officer(officer)
@@ -172,7 +168,6 @@ describe "Voter" do
end end
expect(page).to have_content "You have already participated in a physical booth. " \ expect(page).to have_content "You have already participated in a physical booth. " \
"You can not participate again." "You can not participate again."
expect(Poll::Voter.count).to eq(1)
logout logout
login_as(admin.user) login_as(admin.user)
@@ -211,7 +206,6 @@ describe "Voter" do
expect(page).to have_content "You have already participated in a physical booth. " \ expect(page).to have_content "You have already participated in a physical booth. " \
"You can not participate again." "You can not participate again."
expect(Poll::Voter.count).to eq(1)
logout logout
login_as(admin.user) login_as(admin.user)