Update tests for votation type form behavior

Ensure the form toggles descriptions and fields correctly depending on the selected
votation type.
This commit is contained in:
taitus
2025-07-16 12:02:24 +02:00
parent d8f03c3b6e
commit 2a5985f6ef

View File

@@ -71,12 +71,17 @@ describe "Admin poll questions", :admin do
poll = create(:poll, :future) poll = create(:poll, :future)
visit admin_poll_path(poll) visit admin_poll_path(poll)
click_link "Create question" click_link "Create question"
expect(page).to have_content "It's only possible to answer one time to the question."
end end
scenario "Unique" do scenario "Unique" do
fill_in "Question", with: "Question with unique answer" fill_in "Question", with: "Question with unique answer"
select "Unique answer", from: "Votation type" 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" click_button "Save"
expect(page).to have_content "Question with unique answer" expect(page).to have_content "Question with unique answer"
@@ -86,6 +91,10 @@ describe "Admin poll questions", :admin do
scenario "Multiple" do scenario "Multiple" do
fill_in "Question", with: "Question with multiple answers" fill_in "Question", with: "Question with multiple answers"
select "Multiple answers", from: "Votation type" 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 fill_in "Maximum number of votes", with: 6
click_button "Save" click_button "Save"