Unify flaggable specs
This commit is contained in:
@@ -5,7 +5,7 @@ FactoryBot.define do
|
|||||||
sequence(:body) { |n| "Comment body #{n}" }
|
sequence(:body) { |n| "Comment body #{n}" }
|
||||||
|
|
||||||
%i[budget_investment debate legislation_annotation legislation_question legislation_proposal
|
%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
|
factory :"#{model}_comment" do
|
||||||
commentable factory: model
|
commentable factory: model
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ require "rails_helper"
|
|||||||
describe "Commenting Budget::Investments" do
|
describe "Commenting Budget::Investments" do
|
||||||
let(:investment) { create(:budget_investment) }
|
let(:investment) { create(:budget_investment) }
|
||||||
|
|
||||||
it_behaves_like "flaggable", :budget_investment_comment
|
|
||||||
|
|
||||||
describe "Administrators" do
|
describe "Administrators" do
|
||||||
context "comment as administrator" do
|
context "comment as administrator" do
|
||||||
scenario "display administrator description on admin views" do
|
scenario "display administrator description on admin views" do
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
require "rails_helper"
|
|
||||||
|
|
||||||
describe "Commenting debates" do
|
|
||||||
it_behaves_like "flaggable", :debate_comment
|
|
||||||
end
|
|
||||||
@@ -4,8 +4,6 @@ describe "Commenting legislation questions" do
|
|||||||
let(:user) { create(:user) }
|
let(:user) { create(:user) }
|
||||||
let(:annotation) { create(:legislation_annotation, author: user) }
|
let(:annotation) { create(:legislation_annotation, author: user) }
|
||||||
|
|
||||||
it_behaves_like "flaggable", :legislation_annotation_comment
|
|
||||||
|
|
||||||
describe "Merged comment threads" do
|
describe "Merged comment threads" do
|
||||||
let!(:draft_version) { create(:legislation_draft_version, :published) }
|
let!(:draft_version) { create(:legislation_draft_version, :published) }
|
||||||
let!(:annotation1) do
|
let!(:annotation1) do
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
require "rails_helper"
|
require "rails_helper"
|
||||||
|
|
||||||
describe "Commenting legislation questions" do
|
describe "Commenting legislation questions" do
|
||||||
context "Concerns" do
|
|
||||||
it_behaves_like "notifiable in-app", :legislation_question
|
it_behaves_like "notifiable in-app", :legislation_question
|
||||||
it_behaves_like "flaggable", :legislation_question_comment
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
require "rails_helper"
|
|
||||||
|
|
||||||
describe "Commenting proposals" do
|
|
||||||
it_behaves_like "flaggable", :proposal_comment
|
|
||||||
end
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
require "rails_helper"
|
|
||||||
|
|
||||||
describe "Commenting topics from proposals" do
|
|
||||||
it_behaves_like "flaggable", :topic_with_community_comment
|
|
||||||
end
|
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
require "rails_helper"
|
require "rails_helper"
|
||||||
|
|
||||||
describe "Comments" do
|
describe "Comments" do
|
||||||
let(:factory) {
|
factories = [
|
||||||
[
|
|
||||||
:budget_investment,
|
:budget_investment,
|
||||||
:debate,
|
:debate,
|
||||||
:legislation_annotation,
|
:legislation_annotation,
|
||||||
@@ -11,8 +10,9 @@ describe "Comments" do
|
|||||||
:proposal,
|
:proposal,
|
||||||
:topic_with_community,
|
:topic_with_community,
|
||||||
:topic_with_investment_community
|
:topic_with_investment_community
|
||||||
].sample
|
]
|
||||||
}
|
|
||||||
|
let(:factory) { factories.sample }
|
||||||
let(:resource) { create(factory) }
|
let(:resource) { create(factory) }
|
||||||
let(:user) do
|
let(:user) do
|
||||||
if factory == :legislation_question
|
if factory == :legislation_question
|
||||||
@@ -36,6 +36,8 @@ describe "Comments" do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it_behaves_like "flaggable", :"#{(factories - [:poll_with_author]).sample}_comment"
|
||||||
|
|
||||||
describe "Index" do
|
describe "Index" do
|
||||||
context "Budget Investments" do
|
context "Budget Investments" do
|
||||||
let(:investment) { create(:budget_investment) }
|
let(:investment) { create(:budget_investment) }
|
||||||
|
|||||||
Reference in New Issue
Block a user