Prevent balloting online after casting a ballot offline

This commit is contained in:
rgarcia
2018-06-04 20:02:00 +02:00
committed by Javi Martín
parent 20a3f6539d
commit aa7441271d
5 changed files with 33 additions and 4 deletions

View File

@@ -2,7 +2,10 @@ require "rails_helper"
feature "BudgetPolls", :with_frozen_time do
let(:budget) { create(:budget, :balloting) }
let(:poll) { create(:poll, :current) }
let(:group) { create(:budget_group, budget: budget) }
let(:heading) { create(:budget_heading, group: group) }
let(:investment) { create(:budget_investment, :selected, heading: heading) }
let(:poll) { create(:poll, :current, budget: budget) }
let(:booth) { create(:poll_booth) }
let(:officer) { create(:poll_officer) }
let(:admin) { create(:administrator) }
@@ -67,10 +70,29 @@ feature "BudgetPolls", :with_frozen_time do
end
end
scenario "A citizen cannot vote online after voting offline" do
# create scenario for an user that voted offline
scenario "A citizen cannot vote online after voting offline", :js do
user = create(:user, :in_census)
# Check the citizen cannot vote online
login_through_form_as_officer(officer.user)
visit new_officing_residence_path
officing_verify_residence
within("#poll_#{poll.id}") do
click_button("Confirm vote")
end
expect(page).to have_content "Vote introduced!"
login_as(user)
visit budget_investment_path(budget, investment)
find("div.ballot").hover
within("#budget_investment_#{investment.id}") do
expect(page).to have_content "You have already participated offline"
expect(page).to have_css(".add a", visible: false)
end
end
end