From 992a8182ff40c444a294b854ba01abdcd416e204 Mon Sep 17 00:00:00 2001 From: taitus Date: Tue, 19 Dec 2023 23:41:22 +0100 Subject: [PATCH] Unify voting comments update specs --- .../comments/budget_investments_spec.rb | 24 ---------- spec/system/comments/debates_spec.rb | 24 ---------- .../comments/legislation_annotations_spec.rb | 24 ---------- .../comments/legislation_questions_spec.rb | 24 ---------- spec/system/comments/polls_spec.rb | 24 ---------- spec/system/comments/proposals_spec.rb | 24 ---------- spec/system/comments/topics_spec.rb | 48 ------------------- spec/system/comments_spec.rb | 24 ++++++++++ 8 files changed, 24 insertions(+), 192 deletions(-) diff --git a/spec/system/comments/budget_investments_spec.rb b/spec/system/comments/budget_investments_spec.rb index e41fd3d41..cc2dbddef 100644 --- a/spec/system/comments/budget_investments_spec.rb +++ b/spec/system/comments/budget_investments_spec.rb @@ -81,30 +81,6 @@ describe "Commenting Budget::Investments" do login_as(verified) end - scenario "Update" 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 - - click_button "I disagree" - - within(".in-favor") do - expect(page).to have_content "0" - end - - within(".against") do - expect(page).to have_content "1" - end - - expect(page).to have_content "1 vote" - end - end - scenario "Allow undoing votes" do visit budget_investment_path(budget, investment) diff --git a/spec/system/comments/debates_spec.rb b/spec/system/comments/debates_spec.rb index 0d1eca9ff..38abb0f45 100644 --- a/spec/system/comments/debates_spec.rb +++ b/spec/system/comments/debates_spec.rb @@ -135,30 +135,6 @@ describe "Commenting debates" do login_as(verified) end - scenario "Update" 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 - - click_button "I disagree" - - within(".in-favor") do - expect(page).to have_content "0" - end - - within(".against") do - expect(page).to have_content "1" - end - - expect(page).to have_content "1 vote" - end - end - scenario "Allow undoing votes" do visit debate_path(debate) diff --git a/spec/system/comments/legislation_annotations_spec.rb b/spec/system/comments/legislation_annotations_spec.rb index 3f89c586a..1694aa3ed 100644 --- a/spec/system/comments/legislation_annotations_spec.rb +++ b/spec/system/comments/legislation_annotations_spec.rb @@ -30,30 +30,6 @@ describe "Commenting legislation questions" do login_as(verified) end - scenario "Update" 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 - - click_button "I disagree" - - within(".in-favor") do - expect(page).to have_content "0" - end - - within(".against") do - expect(page).to have_content "1" - end - - expect(page).to have_content "1 vote" - end - end - scenario "Allow undoing votes" do visit polymorphic_path(annotation) diff --git a/spec/system/comments/legislation_questions_spec.rb b/spec/system/comments/legislation_questions_spec.rb index 82b019931..d75772321 100644 --- a/spec/system/comments/legislation_questions_spec.rb +++ b/spec/system/comments/legislation_questions_spec.rb @@ -32,30 +32,6 @@ describe "Commenting legislation questions" do login_as(verified) end - scenario "Update" 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 - - click_button "I disagree" - - within(".in-favor") do - expect(page).to have_content "0" - end - - within(".against") do - expect(page).to have_content "1" - end - - expect(page).to have_content "1 vote" - end - end - scenario "Allow undoing votes" 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 51fc83034..8e5710647 100644 --- a/spec/system/comments/polls_spec.rb +++ b/spec/system/comments/polls_spec.rb @@ -14,30 +14,6 @@ describe "Commenting polls" do login_as(verified) end - scenario "Update" 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 - - click_button "I disagree" - - within(".in-favor") do - expect(page).to have_content "0" - end - - within(".against") do - expect(page).to have_content "1" - end - - expect(page).to have_content "1 vote" - end - end - scenario "Allow undoing votes" do visit poll_path(poll) diff --git a/spec/system/comments/proposals_spec.rb b/spec/system/comments/proposals_spec.rb index a567c6713..5fbbf3dfd 100644 --- a/spec/system/comments/proposals_spec.rb +++ b/spec/system/comments/proposals_spec.rb @@ -15,30 +15,6 @@ describe "Commenting proposals" do login_as(verified) end - scenario "Update" 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 - - click_button "I disagree" - - within(".in-favor") do - expect(page).to have_content "0" - end - - within(".against") do - expect(page).to have_content "1" - end - - expect(page).to have_content "1 vote" - end - end - scenario "Allow undoing votes" do visit proposal_path(proposal) diff --git a/spec/system/comments/topics_spec.rb b/spec/system/comments/topics_spec.rb index bffb5bcd0..d119f7139 100644 --- a/spec/system/comments/topics_spec.rb +++ b/spec/system/comments/topics_spec.rb @@ -16,30 +16,6 @@ describe "Commenting topics from proposals" do login_as(verified) end - scenario "Update" 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 - - click_button "I disagree" - - within(".in-favor") do - expect(page).to have_content "0" - end - - within(".against") do - expect(page).to have_content "1" - end - - expect(page).to have_content "1 vote" - end - end - scenario "Allow undoing votes" do visit community_topic_path(proposal.community, topic) @@ -81,30 +57,6 @@ describe "Commenting topics from budget investments" do login_as(verified) end - scenario "Update" 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 - - click_button "I disagree" - - within(".in-favor") do - expect(page).to have_content "0" - end - - within(".against") do - expect(page).to have_content "1" - end - - expect(page).to have_content "1 vote" - end - end - scenario "Allow undoing votes" do visit community_topic_path(investment.community, topic) diff --git a/spec/system/comments_spec.rb b/spec/system/comments_spec.rb index 9cfa01cc9..b189a1b36 100644 --- a/spec/system/comments_spec.rb +++ b/spec/system/comments_spec.rb @@ -541,6 +541,30 @@ describe "Comments" do expect(page).to have_content "1 vote" end end + + scenario "Update" 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 + + click_button "I disagree" + + within(".in-favor") do + expect(page).to have_content "0" + end + + within(".against") do + expect(page).to have_content "1" + end + + expect(page).to have_content "1 vote" + end + end end scenario "Errors on create" do