Unify erasing a comment's author comments specs
This commit is contained in:
@@ -5,18 +5,6 @@ describe "Commenting Budget::Investments" do
|
||||
|
||||
it_behaves_like "flaggable", :budget_investment_comment
|
||||
|
||||
scenario "Erasing a comment's author" do
|
||||
investment = create(:budget_investment)
|
||||
comment = create(:comment, commentable: investment, body: "this should be visible")
|
||||
comment.user.erase
|
||||
|
||||
visit budget_investment_path(investment.budget, investment)
|
||||
within "#comment_#{comment.id}" do
|
||||
expect(page).to have_content("User deleted")
|
||||
expect(page).to have_content("this should be visible")
|
||||
end
|
||||
end
|
||||
|
||||
describe "Moderators" do
|
||||
scenario "can create comment as a moderator" do
|
||||
moderator = create(:moderator)
|
||||
|
||||
@@ -112,18 +112,6 @@ describe "Commenting debates" do
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Erasing a comment's author" do
|
||||
debate = create(:debate)
|
||||
comment = create(:comment, commentable: debate, body: "this should be visible")
|
||||
comment.user.erase
|
||||
|
||||
visit debate_path(debate)
|
||||
within "#comment_#{comment.id}" do
|
||||
expect(page).to have_content("User deleted")
|
||||
expect(page).to have_content("this should be visible")
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Submit button is disabled after clicking" do
|
||||
debate = create(:debate)
|
||||
login_as(user)
|
||||
|
||||
@@ -6,19 +6,6 @@ describe "Commenting legislation questions" do
|
||||
|
||||
it_behaves_like "flaggable", :legislation_annotation_comment
|
||||
|
||||
scenario "Erasing a comment's author" do
|
||||
annotation = create(:legislation_annotation)
|
||||
comment = create(:comment, commentable: annotation, body: "this should be visible")
|
||||
comment.user.erase
|
||||
|
||||
visit polymorphic_path(annotation)
|
||||
|
||||
within "#comment_#{comment.id}" do
|
||||
expect(page).to have_content("User deleted")
|
||||
expect(page).to have_content("this should be visible")
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Submit button is disabled after clicking" do
|
||||
annotation = create(:legislation_annotation)
|
||||
login_as(user)
|
||||
|
||||
@@ -10,17 +10,6 @@ describe "Commenting legislation questions" do
|
||||
it_behaves_like "flaggable", :legislation_question_comment
|
||||
end
|
||||
|
||||
scenario "Erasing a comment's author" do
|
||||
comment = create(:comment, commentable: question, body: "this should be visible")
|
||||
comment.user.erase
|
||||
|
||||
visit legislation_process_question_path(question.process, question)
|
||||
within "#comment_#{comment.id}" do
|
||||
expect(page).to have_content("User deleted")
|
||||
expect(page).to have_content("this should be visible")
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Submit button is disabled after clicking" do
|
||||
login_as(user)
|
||||
visit legislation_process_question_path(question.process, question)
|
||||
|
||||
@@ -4,18 +4,6 @@ describe "Commenting polls" do
|
||||
let(:user) { create(:user) }
|
||||
let(:poll) { create(:poll, author: create(:user)) }
|
||||
|
||||
scenario "Erasing a comment's author" do
|
||||
poll = create(:poll)
|
||||
comment = create(:comment, commentable: poll, body: "this should be visible")
|
||||
comment.user.erase
|
||||
|
||||
visit poll_path(poll)
|
||||
within "#comment_#{comment.id}" do
|
||||
expect(page).to have_content("User deleted")
|
||||
expect(page).to have_content("this should be visible")
|
||||
end
|
||||
end
|
||||
|
||||
describe "Moderators" do
|
||||
scenario "can create comment as a moderator" do
|
||||
moderator = create(:moderator)
|
||||
|
||||
@@ -5,18 +5,6 @@ describe "Commenting proposals" do
|
||||
|
||||
it_behaves_like "flaggable", :proposal_comment
|
||||
|
||||
scenario "Erasing a comment's author" do
|
||||
proposal = create(:proposal)
|
||||
comment = create(:comment, commentable: proposal, body: "this should be visible")
|
||||
comment.user.erase
|
||||
|
||||
visit proposal_path(proposal)
|
||||
within "#comment_#{comment.id}" do
|
||||
expect(page).to have_content("User deleted")
|
||||
expect(page).to have_content("this should be visible")
|
||||
end
|
||||
end
|
||||
|
||||
describe "Moderators" do
|
||||
scenario "can create comment as a moderator" do
|
||||
moderator = create(:moderator)
|
||||
|
||||
@@ -5,20 +5,6 @@ describe "Commenting topics from proposals" do
|
||||
|
||||
it_behaves_like "flaggable", :topic_with_community_comment
|
||||
|
||||
scenario "Erasing a comment's author" do
|
||||
community = proposal.community
|
||||
topic = create(:topic, community: community)
|
||||
comment = create(:comment, commentable: topic, body: "this should be visible")
|
||||
comment.user.erase
|
||||
|
||||
visit community_topic_path(community, topic)
|
||||
|
||||
within "#comment_#{comment.id}" do
|
||||
expect(page).to have_content("User deleted")
|
||||
expect(page).to have_content("this should be visible")
|
||||
end
|
||||
end
|
||||
|
||||
describe "Moderators" do
|
||||
scenario "can create comment as a moderator" do
|
||||
community = proposal.community
|
||||
@@ -243,20 +229,6 @@ describe "Commenting topics from budget investments" do
|
||||
let(:user) { create(:user) }
|
||||
let(:investment) { create(:budget_investment) }
|
||||
|
||||
scenario "Erasing a comment's author" do
|
||||
community = investment.community
|
||||
topic = create(:topic, community: community)
|
||||
comment = create(:comment, commentable: topic, body: "this should be visible")
|
||||
comment.user.erase
|
||||
|
||||
visit community_topic_path(community, topic)
|
||||
|
||||
within "#comment_#{comment.id}" do
|
||||
expect(page).to have_content("User deleted")
|
||||
expect(page).to have_content("this should be visible")
|
||||
end
|
||||
end
|
||||
|
||||
describe "Moderators" do
|
||||
scenario "can create comment as a moderator" do
|
||||
community = investment.community
|
||||
|
||||
@@ -389,6 +389,17 @@ describe "Comments" do
|
||||
expect(page).to have_css(".comment.comment.comment.comment.comment.comment.comment.comment")
|
||||
end
|
||||
|
||||
scenario "Erasing a comment's author" do
|
||||
comment = create(:comment, commentable: resource, body: "this should be visible")
|
||||
comment.user.erase
|
||||
|
||||
visit polymorphic_path(resource)
|
||||
|
||||
within ".comment", text: "this should be visible" do
|
||||
expect(page).to have_content("User deleted")
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Errors on create" do
|
||||
login_as(user)
|
||||
visit polymorphic_path(resource)
|
||||
|
||||
Reference in New Issue
Block a user