Fixed tests

This commit is contained in:
María Checa
2017-10-04 11:18:09 +02:00
parent 8dc05d399b
commit 5b7a90221a
2 changed files with 13 additions and 13 deletions

View File

@@ -10,12 +10,13 @@ feature "Voter" do
user = create(:user, :level_two)
login_as user
visit question_path(question)
visit poll_path(poll)
click_link 'Go to voting page'
click_link 'Yes'
within("#poll_question_#{question.id}_answers") do
click_link 'Yes'
expect(page).to_not have_link('Yes')
end
expect(page).to_not have_link('Yes')
expect(Poll::Voter.count).to eq(1)
expect(Poll::Voter.first.origin).to eq("web")
end
@@ -56,7 +57,7 @@ feature "Voter" do
scenario "Trying to vote in web and then in booth", :js do
login_as user
vote_for_poll_via_web
vote_for_poll_via_web(poll, question)
click_link "Sign out"
@@ -79,9 +80,7 @@ feature "Voter" do
click_link "Sign out"
login_as user
visit question_path(question)
click_link 'Go to voting page'
visit poll_path(poll)
expect(page).to_not have_link('Yes')
expect(page).to have_content "You have already participated in a booth for this poll."

View File

@@ -298,13 +298,14 @@ module CommonActions
end
end
def vote_for_poll_via_web
visit question_path(question)
def vote_for_poll_via_web(poll, question)
visit poll_path(poll)
click_link 'Go to voting page'
click_link 'Yes'
within("#poll_question_#{question.id}_answers") do
click_link 'Yes'
expect(page).to_not have_link('Yes')
end
expect(page).to_not have_link('Yes')
expect(Poll::Voter.count).to eq(1)
end