From 2a5985f6efa4662015e3716f336a81ef1008581c Mon Sep 17 00:00:00 2001 From: taitus Date: Wed, 16 Jul 2025 12:02:24 +0200 Subject: [PATCH] Update tests for votation type form behavior Ensure the form toggles descriptions and fields correctly depending on the selected votation type. --- spec/system/admin/poll/questions_spec.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spec/system/admin/poll/questions_spec.rb b/spec/system/admin/poll/questions_spec.rb index 127dca219..2a504de98 100644 --- a/spec/system/admin/poll/questions_spec.rb +++ b/spec/system/admin/poll/questions_spec.rb @@ -71,12 +71,17 @@ describe "Admin poll questions", :admin do poll = create(:poll, :future) visit admin_poll_path(poll) click_link "Create question" + expect(page).to have_content "It's only possible to answer one time to the question." end scenario "Unique" do fill_in "Question", with: "Question with unique answer" select "Unique answer", from: "Votation type" + expect(page).to have_content "It's only possible to answer one time to the question." + expect(page).not_to have_content "Allows to choose multiple answers." + expect(page).not_to have_field "Maximum number of votes" + click_button "Save" expect(page).to have_content "Question with unique answer" @@ -86,6 +91,10 @@ describe "Admin poll questions", :admin do scenario "Multiple" do fill_in "Question", with: "Question with multiple answers" select "Multiple answers", from: "Votation type" + + expect(page).not_to have_content "It's only possible to answer one time to the question." + expect(page).to have_content "Allows to choose multiple answers." + fill_in "Maximum number of votes", with: 6 click_button "Save"