Switch from valid_answers to question_answers on specs

This commit is contained in:
Bertocq
2017-10-18 01:28:38 +02:00
parent 60f2815010
commit 39f23d3b7b
4 changed files with 39 additions and 22 deletions

View File

@@ -261,8 +261,13 @@ feature 'Admin polls' do
booth_assignment_2 = create(:poll_booth_assignment, poll: poll)
booth_assignment_3 = create(:poll_booth_assignment, poll: poll)
question_1 = create(:poll_question, poll: poll, valid_answers: "Yes,No")
question_2 = create(:poll_question, poll: poll, valid_answers: "Today,Tomorrow")
question_1 = create(:poll_question, poll: poll)
create(:poll_question_answer, title: 'Yes', question: question_1)
create(:poll_question_answer, title: 'No', question: question_1)
question_2 = create(:poll_question, poll: poll)
create(:poll_question_answer, title: 'Today', question: question_2)
create(:poll_question_answer, title: 'Tomorrow', question: question_2)
[booth_assignment_1, booth_assignment_2, booth_assignment_3].each do |ba|
create(:poll_partial_result,
@@ -287,17 +292,17 @@ feature 'Admin polls' do
click_link "Results"
expect(page).to have_content(question_1.title)
question_1.valid_answers.each_with_index do |answer, i|
question_1.question_answers.each_with_index do |answer, i|
within("#question_#{question_1.id}_#{i}_result") do
expect(page).to have_content(answer)
expect(page).to have_content(answer.title)
expect(page).to have_content([33, 0][i])
end
end
expect(page).to have_content(question_2.title)
question_2.valid_answers.each_with_index do |answer, i|
question_2.question_answers.each_with_index do |answer, i|
within("#question_#{question_2.id}_#{i}_result") do
expect(page).to have_content(answer)
expect(page).to have_content(answer.title)
expect(page).to have_content([0, 15][i])
end
end