Unify reply update parent comments specs

This commit is contained in:
taitus
2023-12-19 18:23:44 +01:00
parent d3f4c7f99e
commit d4f3680dcc
8 changed files with 15 additions and 110 deletions

View File

@@ -6,21 +6,6 @@ describe "Commenting Budget::Investments" do
it_behaves_like "flaggable", :budget_investment_comment
scenario "Reply update parent comment responses count" do
comment = create(:comment, commentable: investment)
login_as(create(:user))
visit budget_investment_path(investment.budget, investment)
within ".comment", text: comment.body do
click_link "Reply"
fill_in "Leave your comment", with: "It will be done next week."
click_button "Publish reply"
expect(page).to have_content("1 response (collapse)")
end
end
scenario "Reply show parent comments responses when hidden" do
comment = create(:comment, commentable: investment)
create(:comment, commentable: investment, parent: comment)

View File

@@ -102,21 +102,6 @@ describe "Commenting debates" do
end
end
scenario "Reply update parent comment responses count" do
comment = create(:comment, commentable: debate)
login_as(create(:user))
visit debate_path(debate)
within ".comment", text: comment.body do
click_link "Reply"
fill_in "Leave your comment", with: "It will be done next week."
click_button "Publish reply"
expect(page).to have_content("1 response (collapse)")
end
end
scenario "Reply show parent comments responses when hidden" do
comment = create(:comment, commentable: debate)
create(:comment, commentable: debate, parent: comment)

View File

@@ -6,23 +6,6 @@ describe "Commenting legislation questions" do
it_behaves_like "flaggable", :legislation_annotation_comment
scenario "Reply update parent comment responses count" do
manuela = create(:user, :level_two, username: "Manuela")
annotation = create(:legislation_annotation)
comment = annotation.comments.first
login_as(manuela)
visit polymorphic_path(annotation)
within ".comment", text: comment.body do
click_link "Reply"
fill_in "Leave your comment", with: "It will be done next week."
click_button "Publish reply"
expect(page).to have_content("1 response (collapse)")
end
end
scenario "Reply show parent comments responses when hidden" do
manuela = create(:user, :level_two, username: "Manuela")
annotation = create(:legislation_annotation)

View File

@@ -10,22 +10,6 @@ describe "Commenting legislation questions" do
it_behaves_like "flaggable", :legislation_question_comment
end
scenario "Reply update parent comment responses count" do
manuela = create(:user, :level_two, username: "Manuela")
comment = create(:comment, commentable: question)
login_as(manuela)
visit legislation_process_question_path(question.process, question)
within ".comment", text: comment.body do
click_link "Reply"
fill_in "Leave your answer", with: "It will be done next week."
click_button "Publish reply"
expect(page).to have_content("1 response (collapse)")
end
end
scenario "Reply show parent comments responses when hidden" do
manuela = create(:user, :level_two, username: "Manuela")
comment = create(:comment, commentable: question)

View File

@@ -4,21 +4,6 @@ describe "Commenting polls" do
let(:user) { create(:user) }
let(:poll) { create(:poll, author: create(:user)) }
scenario "Reply update parent comment responses count" do
comment = create(:comment, commentable: poll)
login_as(create(:user))
visit poll_path(poll)
within ".comment", text: comment.body do
click_link "Reply"
fill_in "Leave your comment", with: "It will be done next week."
click_button "Publish reply"
expect(page).to have_content("1 response (collapse)")
end
end
scenario "Reply show parent comments responses when hidden" do
comment = create(:comment, commentable: poll)
create(:comment, commentable: poll, parent: comment)

View File

@@ -6,21 +6,6 @@ describe "Commenting proposals" do
it_behaves_like "flaggable", :proposal_comment
scenario "Reply update parent comment responses count" do
comment = create(:comment, commentable: proposal)
login_as(create(:user))
visit proposal_path(proposal)
within ".comment", text: comment.body do
click_link "Reply"
fill_in "Leave your comment", with: "It will be done next week."
click_button "Publish reply"
expect(page).to have_content("1 response (collapse)")
end
end
scenario "Reply show parent comments responses when hidden" do
comment = create(:comment, commentable: proposal)
create(:comment, commentable: proposal, parent: comment)

View File

@@ -6,23 +6,6 @@ describe "Commenting topics from proposals" do
it_behaves_like "flaggable", :topic_with_community_comment
scenario "Reply update parent comment responses count" do
community = proposal.community
topic = create(:topic, community: community)
comment = create(:comment, commentable: topic)
login_as(create(:user))
visit community_topic_path(community, topic)
within ".comment", text: comment.body do
click_link "Reply"
fill_in "Leave your comment", with: "It will be done next week."
click_button "Publish reply"
expect(page).to have_content("1 response (collapse)")
end
end
scenario "Reply show parent comments responses when hidden" do
community = proposal.community
topic = create(:topic, community: community)

View File

@@ -328,6 +328,21 @@ describe "Comments" do
expect(page).not_to have_css "#js-comment-form-comment_#{comment.id}"
end
scenario "Reply update parent comment responses count" do
comment = create(:comment, commentable: resource)
login_as(user)
visit polymorphic_path(resource)
within ".comment", text: comment.body do
click_link "Reply"
fill_in fill_text, with: "It will be done next week."
click_button "Publish reply"
expect(page).to have_content("1 response (collapse)")
end
end
scenario "Errors on create" do
login_as(user)
visit polymorphic_path(resource)