Added tests

This commit is contained in:
María Checa
2017-10-16 20:10:49 +02:00
parent 3fc3f9e88e
commit e1e9b431d7

View File

@@ -41,6 +41,27 @@ feature "Voter" do
expect(Poll::Voter.first.origin).to eq("web")
end
scenario "Voting via web as unverified user", :js do
poll = create(:poll)
question = create(:poll_question, poll: poll)
answer1 = create(:poll_question_answer, question: question, title: 'Yes')
answer2 = create(:poll_question_answer, question: question, title: 'No')
user = create(:user, :incomplete_verification)
login_as user
visit poll_path(poll)
within("#poll_question_#{question.id}_answers") do
expect(page).to_not have_link('Yes')
expect(page).to_not have_link('No')
end
expect(page).to have_content("You must verify your account in order to answer")
expect(page).to_not have_content("You have already participated in this poll. If you vote again it will be overwritten")
end
scenario "Voting in booth", :js do
user = create(:user, :in_census)