Unify reply show parent comments specs

This commit is contained in:
taitus
2023-12-19 18:35:49 +01:00
parent d4f3680dcc
commit f4c3e740e6
8 changed files with 18 additions and 124 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -343,6 +343,24 @@ describe "Comments" do
end
end
scenario "Reply show parent comments responses when hidden" do
comment = create(:comment, commentable: resource)
create(:comment, commentable: resource, parent: comment)
login_as(user)
visit polymorphic_path(resource)
within ".comment", text: comment.body do
click_link text: "1 response (collapse)"
click_link "Reply"
fill_in fill_text, with: "It will be done next week."
click_button "Publish reply"
expect(page).to have_content("It will be done next week.")
end
end
scenario "Errors on create" do
login_as(user)
visit polymorphic_path(resource)