diff --git a/spec/factories/comments.rb b/spec/factories/comments.rb index 467395ee5..7f694bf7d 100644 --- a/spec/factories/comments.rb +++ b/spec/factories/comments.rb @@ -5,7 +5,7 @@ FactoryBot.define do sequence(:body) { |n| "Comment body #{n}" } %i[budget_investment debate legislation_annotation legislation_question legislation_proposal - poll proposal topic_with_community].each do |model| + poll proposal topic_with_community topic_with_investment_community].each do |model| factory :"#{model}_comment" do commentable factory: model end diff --git a/spec/system/comments/budget_investments_spec.rb b/spec/system/comments/budget_investments_spec.rb index 62e411233..526bc2fe5 100644 --- a/spec/system/comments/budget_investments_spec.rb +++ b/spec/system/comments/budget_investments_spec.rb @@ -3,8 +3,6 @@ require "rails_helper" describe "Commenting Budget::Investments" do let(:investment) { create(:budget_investment) } - it_behaves_like "flaggable", :budget_investment_comment - describe "Administrators" do context "comment as administrator" do scenario "display administrator description on admin views" do diff --git a/spec/system/comments/debates_spec.rb b/spec/system/comments/debates_spec.rb deleted file mode 100644 index 166afc04d..000000000 --- a/spec/system/comments/debates_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require "rails_helper" - -describe "Commenting debates" do - it_behaves_like "flaggable", :debate_comment -end diff --git a/spec/system/comments/legislation_annotations_spec.rb b/spec/system/comments/legislation_annotations_spec.rb index 1d41e9ccf..f56fcdf1c 100644 --- a/spec/system/comments/legislation_annotations_spec.rb +++ b/spec/system/comments/legislation_annotations_spec.rb @@ -4,8 +4,6 @@ describe "Commenting legislation questions" do let(:user) { create(:user) } let(:annotation) { create(:legislation_annotation, author: user) } - it_behaves_like "flaggable", :legislation_annotation_comment - describe "Merged comment threads" do let!(:draft_version) { create(:legislation_draft_version, :published) } let!(:annotation1) do diff --git a/spec/system/comments/legislation_questions_spec.rb b/spec/system/comments/legislation_questions_spec.rb index 5f3df2261..af5f05e85 100644 --- a/spec/system/comments/legislation_questions_spec.rb +++ b/spec/system/comments/legislation_questions_spec.rb @@ -1,8 +1,5 @@ require "rails_helper" describe "Commenting legislation questions" do - context "Concerns" do - it_behaves_like "notifiable in-app", :legislation_question - it_behaves_like "flaggable", :legislation_question_comment - end + it_behaves_like "notifiable in-app", :legislation_question end diff --git a/spec/system/comments/proposals_spec.rb b/spec/system/comments/proposals_spec.rb deleted file mode 100644 index 970aa8d89..000000000 --- a/spec/system/comments/proposals_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require "rails_helper" - -describe "Commenting proposals" do - it_behaves_like "flaggable", :proposal_comment -end diff --git a/spec/system/comments/topics_spec.rb b/spec/system/comments/topics_spec.rb deleted file mode 100644 index 9a109d611..000000000 --- a/spec/system/comments/topics_spec.rb +++ /dev/null @@ -1,5 +0,0 @@ -require "rails_helper" - -describe "Commenting topics from proposals" do - it_behaves_like "flaggable", :topic_with_community_comment -end diff --git a/spec/system/comments_spec.rb b/spec/system/comments_spec.rb index 2bcada4ac..bf8ced835 100644 --- a/spec/system/comments_spec.rb +++ b/spec/system/comments_spec.rb @@ -1,18 +1,18 @@ require "rails_helper" describe "Comments" do - let(:factory) { - [ - :budget_investment, - :debate, - :legislation_annotation, - :legislation_question, - :poll_with_author, - :proposal, - :topic_with_community, - :topic_with_investment_community - ].sample - } + factories = [ + :budget_investment, + :debate, + :legislation_annotation, + :legislation_question, + :poll_with_author, + :proposal, + :topic_with_community, + :topic_with_investment_community + ] + + let(:factory) { factories.sample } let(:resource) { create(factory) } let(:user) do if factory == :legislation_question @@ -36,6 +36,8 @@ describe "Comments" do end end + it_behaves_like "flaggable", :"#{(factories - [:poll_with_author]).sample}_comment" + describe "Index" do context "Budget Investments" do let(:investment) { create(:budget_investment) }