Files
grecia/spec/support/common_actions/polls.rb
Javi Martín 5fa6db2226 Rename HTML attributes referencing poll options
Since now poll question answers have been renamed to poll question
options, using HTML IDs, classes and data attributes named `answer` was
confusing.
2024-06-13 19:13:05 +02:00

39 lines
966 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!"
expect(Poll::Voter.count).to eq(1)
end
def confirm_phone(user = nil)
user ||= User.last
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: user.reload.sms_confirmation_code
click_button "Send"
expect(page).to have_content "Code correct"
end
end