Fixed tests
This commit is contained in:
@@ -10,12 +10,13 @@ feature "Voter" do
|
|||||||
user = create(:user, :level_two)
|
user = create(:user, :level_two)
|
||||||
|
|
||||||
login_as user
|
login_as user
|
||||||
visit question_path(question)
|
visit poll_path(poll)
|
||||||
|
|
||||||
click_link 'Go to voting page'
|
within("#poll_question_#{question.id}_answers") do
|
||||||
click_link 'Yes'
|
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.count).to eq(1)
|
||||||
expect(Poll::Voter.first.origin).to eq("web")
|
expect(Poll::Voter.first.origin).to eq("web")
|
||||||
end
|
end
|
||||||
@@ -56,7 +57,7 @@ feature "Voter" do
|
|||||||
|
|
||||||
scenario "Trying to vote in web and then in booth", :js do
|
scenario "Trying to vote in web and then in booth", :js do
|
||||||
login_as user
|
login_as user
|
||||||
vote_for_poll_via_web
|
vote_for_poll_via_web(poll, question)
|
||||||
|
|
||||||
click_link "Sign out"
|
click_link "Sign out"
|
||||||
|
|
||||||
@@ -79,9 +80,7 @@ feature "Voter" do
|
|||||||
click_link "Sign out"
|
click_link "Sign out"
|
||||||
|
|
||||||
login_as user
|
login_as user
|
||||||
visit question_path(question)
|
visit poll_path(poll)
|
||||||
|
|
||||||
click_link 'Go to voting page'
|
|
||||||
|
|
||||||
expect(page).to_not have_link('Yes')
|
expect(page).to_not have_link('Yes')
|
||||||
expect(page).to have_content "You have already participated in a booth for this poll."
|
expect(page).to have_content "You have already participated in a booth for this poll."
|
||||||
|
|||||||
@@ -298,13 +298,14 @@ module CommonActions
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def vote_for_poll_via_web
|
def vote_for_poll_via_web(poll, question)
|
||||||
visit question_path(question)
|
visit poll_path(poll)
|
||||||
|
|
||||||
click_link 'Go to voting page'
|
within("#poll_question_#{question.id}_answers") do
|
||||||
click_link 'Yes'
|
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.count).to eq(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user