Hides not to vote at this time button if already voted

This commit is contained in:
decabeza
2018-06-20 14:38:23 +02:00
committed by Javi Martín
parent 170cc45a20
commit 17730a41dd
3 changed files with 43 additions and 1 deletions

View File

@@ -87,6 +87,43 @@ feature "Voter" do
end
end
context "The person has decided not to vote at this time" do
let!(:user) { create(:user, :in_census) }
scenario "Show not to vote at this time button" do
login_through_form_as_officer(officer.user)
visit new_officing_residence_path
officing_verify_residence
expect(page).to have_content poll.name
expect(page).to have_button "Confirm vote"
expect(page).to have_content "Can vote"
expect(page).to have_link "The person has decided not to vote at this time"
end
scenario "Hides not to vote at this time button if already voted", :js do
login_through_form_as_officer(officer.user)
visit new_officing_residence_path
officing_verify_residence
within("#poll_#{poll.id}") do
click_button("Confirm vote")
expect(page).not_to have_button("Confirm vote")
expect(page).to have_content "Vote introduced!"
expect(page).not_to have_content "The person has decided not to vote at this time"
end
visit new_officing_residence_path
officing_verify_residence
expect(page).to have_content "Has already participated in this poll"
expect(page).not_to have_content "The person has decided not to vote at this time"
end
end
context "Trying to vote the same poll in booth and web" do
let!(:user) { create(:user, :in_census) }