Unify flaggable specs

This commit is contained in:
taitus
2023-12-21 10:56:16 +01:00
parent f328d53f41
commit 3f1561e408
8 changed files with 16 additions and 36 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -1,5 +0,0 @@
require "rails_helper"
describe "Commenting debates" do
it_behaves_like "flaggable", :debate_comment
end

View File

@@ -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

View File

@@ -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
end

View File

@@ -1,5 +0,0 @@
require "rails_helper"
describe "Commenting proposals" do
it_behaves_like "flaggable", :proposal_comment
end

View File

@@ -1,5 +0,0 @@
require "rails_helper"
describe "Commenting topics from proposals" do
it_behaves_like "flaggable", :topic_with_community_comment
end

View File

@@ -1,8 +1,7 @@
require "rails_helper"
describe "Comments" do
let(:factory) {
[
factories = [
:budget_investment,
:debate,
:legislation_annotation,
@@ -11,8 +10,9 @@ describe "Comments" do
:proposal,
:topic_with_community,
:topic_with_investment_community
].sample
}
]
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) }