Rename variables describing poll options as answers

Since we've renamed the class to `Option`, having variables, methods and
texts refering to it as `answer` was confusing.
This commit is contained in:
Javi Martín
2024-06-07 17:27:56 +02:00
parent 38b38d1fcc
commit 8997ed316c
28 changed files with 123 additions and 123 deletions

View File

@@ -119,7 +119,7 @@ describe "Admin polls", :admin do
expect(page).to have_content("There are no polls.")
end
scenario "Can destroy poll with questions and answers" do
scenario "Can destroy poll with questions and options" do
poll = create(:poll, name: "Do you support CONSUL?")
create(:poll_question, :yes_no, poll: poll)

View File

@@ -166,7 +166,7 @@ describe "Polls" do
expect(page).to have_css ".nested-fields", count: 1
end
scenario "Edit poll allows users to remove answers" do
scenario "Edit poll allows users to remove options" do
poll = create(:poll, related: proposal, starts_at: 1.week.from_now)
create(:poll_question, :yes_no, poll: poll)
visit proposal_dashboard_polls_path(proposal)

View File

@@ -11,7 +11,7 @@ describe "Poll Questions" do
expect(proposal_question.title).to appear_before(normal_question.title)
end
scenario "shows answers with an image and no description" do
scenario "shows options with an image and no description" do
poll = create(:poll)
option = create(:poll_question_option, poll: poll, title: "Pedestrian road", description: "")
create(:image, imageable: option, title: "Trees on both sides of the road")

View File

@@ -8,13 +8,13 @@ describe "Poll Results" do
poll = create(:poll, results_enabled: true)
question1 = create(:poll_question, poll: poll)
answer1 = create(:poll_question_option, question: question1, title: "Yes")
answer2 = create(:poll_question_option, question: question1, title: "No")
option1 = create(:poll_question_option, question: question1, title: "Yes")
option2 = create(:poll_question_option, question: question1, title: "No")
question2 = create(:poll_question, poll: poll)
answer3 = create(:poll_question_option, question: question2, title: "Blue")
answer4 = create(:poll_question_option, question: question2, title: "Green")
answer5 = create(:poll_question_option, question: question2, title: "Yellow")
option3 = create(:poll_question_option, question: question2, title: "Blue")
option4 = create(:poll_question_option, question: question2, title: "Green")
option5 = create(:poll_question_option, question: question2, title: "Yellow")
login_as user1
vote_for_poll_via_web(poll, question1, "Yes")
@@ -39,18 +39,18 @@ describe "Poll Results" do
expect(page).to have_content(question2.title)
within("#question_#{question1.id}_results_table") do
expect(find("#answer_#{answer1.id}_result")).to have_content("2 (66.67%)")
expect(find("#answer_#{answer2.id}_result")).to have_content("1 (33.33%)")
expect(find("#answer_#{option1.id}_result")).to have_content("2 (66.67%)")
expect(find("#answer_#{option2.id}_result")).to have_content("1 (33.33%)")
end
within("#question_#{question2.id}_results_table") do
expect(find("#answer_#{answer3.id}_result")).to have_content("1 (33.33%)")
expect(find("#answer_#{answer4.id}_result")).to have_content("1 (33.33%)")
expect(find("#answer_#{answer5.id}_result")).to have_content("1 (33.33%)")
expect(find("#answer_#{option3.id}_result")).to have_content("1 (33.33%)")
expect(find("#answer_#{option4.id}_result")).to have_content("1 (33.33%)")
expect(find("#answer_#{option5.id}_result")).to have_content("1 (33.33%)")
end
end
scenario "Results for polls with questions but without answers" do
scenario "Results for polls with questions but without options" do
poll = create(:poll, :expired, results_enabled: true)
question = create(:poll_question, poll: poll)