From 35bc03f640a5508568b2b58217e29d16ae71a8ea Mon Sep 17 00:00:00 2001 From: taitus Date: Tue, 19 Dec 2023 23:38:24 +0100 Subject: [PATCH] Unify voting comments create specs --- .../comments/budget_investments_spec.rb | 18 ---------- spec/system/comments/debates_spec.rb | 18 ---------- .../comments/legislation_annotations_spec.rb | 18 ---------- .../comments/legislation_questions_spec.rb | 18 ---------- spec/system/comments/polls_spec.rb | 18 ---------- spec/system/comments/proposals_spec.rb | 18 ---------- spec/system/comments/topics_spec.rb | 36 ------------------- spec/system/comments_spec.rb | 18 ++++++++++ 8 files changed, 18 insertions(+), 144 deletions(-) diff --git a/spec/system/comments/budget_investments_spec.rb b/spec/system/comments/budget_investments_spec.rb index 0a3134f42..e41fd3d41 100644 --- a/spec/system/comments/budget_investments_spec.rb +++ b/spec/system/comments/budget_investments_spec.rb @@ -81,24 +81,6 @@ describe "Commenting Budget::Investments" do login_as(verified) end - scenario "Create" do - visit budget_investment_path(budget, investment) - - within("#comment_#{comment.id}_votes") do - click_button "I agree" - - within(".in-favor") do - expect(page).to have_content "1" - end - - within(".against") do - expect(page).to have_content "0" - end - - expect(page).to have_content "1 vote" - end - end - scenario "Update" do visit budget_investment_path(budget, investment) diff --git a/spec/system/comments/debates_spec.rb b/spec/system/comments/debates_spec.rb index fa5a5879c..0d1eca9ff 100644 --- a/spec/system/comments/debates_spec.rb +++ b/spec/system/comments/debates_spec.rb @@ -135,24 +135,6 @@ describe "Commenting debates" do login_as(verified) end - scenario "Create" do - visit debate_path(debate) - - within("#comment_#{comment.id}_votes") do - click_button "I agree" - - within(".in-favor") do - expect(page).to have_content "1" - end - - within(".against") do - expect(page).to have_content "0" - end - - expect(page).to have_content "1 vote" - end - end - scenario "Update" do visit debate_path(debate) diff --git a/spec/system/comments/legislation_annotations_spec.rb b/spec/system/comments/legislation_annotations_spec.rb index ceed86707..3f89c586a 100644 --- a/spec/system/comments/legislation_annotations_spec.rb +++ b/spec/system/comments/legislation_annotations_spec.rb @@ -30,24 +30,6 @@ describe "Commenting legislation questions" do login_as(verified) end - scenario "Create" do - visit polymorphic_path(annotation) - - within("#comment_#{comment.id}_votes") do - click_button "I agree" - - within(".in-favor") do - expect(page).to have_content "1" - end - - within(".against") do - expect(page).to have_content "0" - end - - expect(page).to have_content "1 vote" - end - end - scenario "Update" do visit polymorphic_path(annotation) diff --git a/spec/system/comments/legislation_questions_spec.rb b/spec/system/comments/legislation_questions_spec.rb index 117850580..82b019931 100644 --- a/spec/system/comments/legislation_questions_spec.rb +++ b/spec/system/comments/legislation_questions_spec.rb @@ -32,24 +32,6 @@ describe "Commenting legislation questions" do login_as(verified) end - scenario "Create" do - visit legislation_process_question_path(question.process, question) - - within("#comment_#{comment.id}_votes") do - click_button "I agree" - - within(".in-favor") do - expect(page).to have_content "1" - end - - within(".against") do - expect(page).to have_content "0" - end - - expect(page).to have_content "1 vote" - end - end - scenario "Update" do visit legislation_process_question_path(question.process, question) diff --git a/spec/system/comments/polls_spec.rb b/spec/system/comments/polls_spec.rb index e304814f0..51fc83034 100644 --- a/spec/system/comments/polls_spec.rb +++ b/spec/system/comments/polls_spec.rb @@ -14,24 +14,6 @@ describe "Commenting polls" do login_as(verified) end - scenario "Create" do - visit poll_path(poll) - - within("#comment_#{comment.id}_votes") do - click_button "I agree" - - within(".in-favor") do - expect(page).to have_content "1" - end - - within(".against") do - expect(page).to have_content "0" - end - - expect(page).to have_content "1 vote" - end - end - scenario "Update" do visit poll_path(poll) diff --git a/spec/system/comments/proposals_spec.rb b/spec/system/comments/proposals_spec.rb index 4d390c473..a567c6713 100644 --- a/spec/system/comments/proposals_spec.rb +++ b/spec/system/comments/proposals_spec.rb @@ -15,24 +15,6 @@ describe "Commenting proposals" do login_as(verified) end - scenario "Create" do - visit proposal_path(proposal) - - within("#comment_#{comment.id}_votes") do - click_button "I agree" - - within(".in-favor") do - expect(page).to have_content "1" - end - - within(".against") do - expect(page).to have_content "0" - end - - expect(page).to have_content "1 vote" - end - end - scenario "Update" do visit proposal_path(proposal) diff --git a/spec/system/comments/topics_spec.rb b/spec/system/comments/topics_spec.rb index fc5c5e7c2..bffb5bcd0 100644 --- a/spec/system/comments/topics_spec.rb +++ b/spec/system/comments/topics_spec.rb @@ -16,24 +16,6 @@ describe "Commenting topics from proposals" do login_as(verified) end - scenario "Create" do - visit community_topic_path(proposal.community, topic) - - within("#comment_#{comment.id}_votes") do - click_button "I agree" - - within(".in-favor") do - expect(page).to have_content "1" - end - - within(".against") do - expect(page).to have_content "0" - end - - expect(page).to have_content "1 vote" - end - end - scenario "Update" do visit community_topic_path(proposal.community, topic) @@ -99,24 +81,6 @@ describe "Commenting topics from budget investments" do login_as(verified) end - scenario "Create" do - visit community_topic_path(investment.community, topic) - - within("#comment_#{comment.id}_votes") do - click_button "I agree" - - within(".in-favor") do - expect(page).to have_content "1" - end - - within(".against") do - expect(page).to have_content "0" - end - - expect(page).to have_content "1 vote" - end - end - scenario "Update" do visit community_topic_path(investment.community, topic) diff --git a/spec/system/comments_spec.rb b/spec/system/comments_spec.rb index fc090b1f0..9cfa01cc9 100644 --- a/spec/system/comments_spec.rb +++ b/spec/system/comments_spec.rb @@ -523,6 +523,24 @@ describe "Comments" do expect(page).to have_content "2 votes" end end + + scenario "Create" do + visit polymorphic_path(resource) + + within("#comment_#{comment.id}_votes") do + click_button "I agree" + + within(".in-favor") do + expect(page).to have_content "1" + end + + within(".against") do + expect(page).to have_content "0" + end + + expect(page).to have_content "1 vote" + end + end end scenario "Errors on create" do