As mentioned in commits likea586ba806,a7664ad81,006128da5,b41fbfa52andc480cdd91, 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.
35 lines
868 B
Ruby
35 lines
868 B
Ruby
module Polls
|
|
def vote_for_poll_via_web(poll, question, option)
|
|
visit poll_path(poll)
|
|
|
|
within("#poll_question_#{question.id}_options") do
|
|
click_button option
|
|
|
|
expect(page).to have_button("You have voted #{option}")
|
|
expect(page).not_to have_button("Vote #{option}")
|
|
end
|
|
end
|
|
|
|
def vote_for_poll_via_booth
|
|
visit new_officing_residence_path
|
|
officing_verify_residence
|
|
|
|
expect(page).to have_content poll.name
|
|
|
|
first(:button, "Confirm vote").click
|
|
expect(page).to have_content "Vote introduced!"
|
|
end
|
|
|
|
def confirm_phone(code:)
|
|
fill_in "sms_phone", with: "611111111"
|
|
click_button "Send"
|
|
|
|
expect(page).to have_content "Enter the confirmation code sent to you by text message"
|
|
|
|
fill_in "sms_confirmation_code", with: code
|
|
click_button "Send"
|
|
|
|
expect(page).to have_content "Code correct"
|
|
end
|
|
end
|