diff --git a/spec/system/comments/budget_investments_spec.rb b/spec/system/comments/budget_investments_spec.rb index 267f2a023..04209b671 100644 --- a/spec/system/comments/budget_investments_spec.rb +++ b/spec/system/comments/budget_investments_spec.rb @@ -6,24 +6,6 @@ describe "Commenting Budget::Investments" do it_behaves_like "flaggable", :budget_investment_comment describe "Moderators" do - scenario "can create comment as a moderator" do - moderator = create(:moderator) - - login_as(moderator.user) - visit budget_investment_path(investment.budget, investment) - - fill_in "Leave your comment", with: "I am moderating!" - check "comment-as-moderator-budget_investment_#{investment.id}" - click_button "Publish comment" - - within "#comments" do - expect(page).to have_content "I am moderating!" - expect(page).to have_content "Moderator ##{moderator.id}" - expect(page).to have_css "div.is-moderator" - expect(page).to have_css "img.moderator-avatar" - end - end - scenario "can create reply as a moderator" do citizen = create(:user, username: "Ana") manuela = create(:user, username: "Manuela") diff --git a/spec/system/comments/debates_spec.rb b/spec/system/comments/debates_spec.rb index 813f1c0c6..52889b46a 100644 --- a/spec/system/comments/debates_spec.rb +++ b/spec/system/comments/debates_spec.rb @@ -126,24 +126,6 @@ describe "Commenting debates" do end describe "Moderators" do - scenario "can create comment as a moderator" do - moderator = create(:moderator) - - login_as(moderator.user) - visit debate_path(debate) - - fill_in "Leave your comment", with: "I am moderating!" - check "comment-as-moderator-debate_#{debate.id}" - click_button "Publish comment" - - within "#comments" do - expect(page).to have_content "I am moderating!" - expect(page).to have_content "Moderator ##{moderator.id}" - expect(page).to have_css "div.is-moderator" - expect(page).to have_css "img.moderator-avatar" - end - end - scenario "can create reply as a moderator" do citizen = create(:user, username: "Ana") manuela = create(:user, username: "Manuela") diff --git a/spec/system/comments/legislation_annotations_spec.rb b/spec/system/comments/legislation_annotations_spec.rb index ad3bbb15b..8c62f8fbd 100644 --- a/spec/system/comments/legislation_annotations_spec.rb +++ b/spec/system/comments/legislation_annotations_spec.rb @@ -21,24 +21,6 @@ describe "Commenting legislation questions" do end describe "Moderators" do - scenario "can create comment as a moderator" do - moderator = create(:moderator) - - login_as(moderator.user) - visit polymorphic_path(annotation) - - fill_in "Leave your comment", with: "I am moderating!" - check "comment-as-moderator-legislation_annotation_#{annotation.id}" - click_button "Publish comment" - - within "#comments" do - expect(page).to have_content "I am moderating!" - expect(page).to have_content "Moderator ##{moderator.id}" - expect(page).to have_css "div.is-moderator" - expect(page).to have_css "img.moderator-avatar" - end - end - scenario "can create reply as a moderator" do citizen = create(:user, username: "Ana") manuela = create(:user, username: "Manuela") diff --git a/spec/system/comments/legislation_questions_spec.rb b/spec/system/comments/legislation_questions_spec.rb index 651fd056a..41f5febad 100644 --- a/spec/system/comments/legislation_questions_spec.rb +++ b/spec/system/comments/legislation_questions_spec.rb @@ -23,24 +23,6 @@ describe "Commenting legislation questions" do end describe "Moderators" do - scenario "can create comment as a moderator" do - moderator = create(:moderator) - - login_as(moderator.user) - visit legislation_process_question_path(question.process, question) - - fill_in "Leave your answer", with: "I am moderating!" - check "comment-as-moderator-legislation_question_#{question.id}" - click_button "Publish answer" - - within "#comments" do - expect(page).to have_content "I am moderating!" - expect(page).to have_content "Moderator ##{moderator.id}" - expect(page).to have_css "div.is-moderator" - expect(page).to have_css "img.moderator-avatar" - end - end - scenario "can create reply as a moderator" do citizen = create(:user, username: "Ana") manuela = create(:user, username: "Manuela") diff --git a/spec/system/comments/polls_spec.rb b/spec/system/comments/polls_spec.rb index 93bb91511..37c4c7f13 100644 --- a/spec/system/comments/polls_spec.rb +++ b/spec/system/comments/polls_spec.rb @@ -5,24 +5,6 @@ describe "Commenting polls" do let(:poll) { create(:poll, author: create(:user)) } describe "Moderators" do - scenario "can create comment as a moderator" do - moderator = create(:moderator) - - login_as(moderator.user) - visit poll_path(poll) - - fill_in "Leave your comment", with: "I am moderating!" - check "comment-as-moderator-poll_#{poll.id}" - click_button "Publish comment" - - within "#comments" do - expect(page).to have_content "I am moderating!" - expect(page).to have_content "Moderator ##{moderator.id}" - expect(page).to have_css "div.is-moderator" - expect(page).to have_css "img.moderator-avatar" - end - end - scenario "can create reply as a moderator" do citizen = create(:user, username: "Ana") manuela = create(:user, username: "Manuela") diff --git a/spec/system/comments/proposals_spec.rb b/spec/system/comments/proposals_spec.rb index 53a85970c..ff716414f 100644 --- a/spec/system/comments/proposals_spec.rb +++ b/spec/system/comments/proposals_spec.rb @@ -6,24 +6,6 @@ describe "Commenting proposals" do it_behaves_like "flaggable", :proposal_comment describe "Moderators" do - scenario "can create comment as a moderator" do - moderator = create(:moderator) - - login_as(moderator.user) - visit proposal_path(proposal) - - fill_in "Leave your comment", with: "I am moderating!" - check "comment-as-moderator-proposal_#{proposal.id}" - click_button "Publish comment" - - within "#comments" do - expect(page).to have_content "I am moderating!" - expect(page).to have_content "Moderator ##{moderator.id}" - expect(page).to have_css "div.is-moderator" - expect(page).to have_css "img.moderator-avatar" - end - end - scenario "can create reply as a moderator" do citizen = create(:user, username: "Ana") manuela = create(:user, username: "Manuela") diff --git a/spec/system/comments/topics_spec.rb b/spec/system/comments/topics_spec.rb index 49d60285e..7d6ddf3c4 100644 --- a/spec/system/comments/topics_spec.rb +++ b/spec/system/comments/topics_spec.rb @@ -6,26 +6,6 @@ describe "Commenting topics from proposals" do it_behaves_like "flaggable", :topic_with_community_comment describe "Moderators" do - scenario "can create comment as a moderator" do - community = proposal.community - topic = create(:topic, community: community) - moderator = create(:moderator) - - login_as(moderator.user) - visit community_topic_path(community, topic) - - fill_in "Leave your comment", with: "I am moderating!" - check "comment-as-moderator-topic_#{topic.id}" - click_button "Publish comment" - - within "#comments" do - expect(page).to have_content "I am moderating!" - expect(page).to have_content "Moderator ##{moderator.id}" - expect(page).to have_css "div.is-moderator" - expect(page).to have_css "img.moderator-avatar" - end - end - scenario "can create reply as a moderator" do community = proposal.community topic = create(:topic, community: community) @@ -230,26 +210,6 @@ describe "Commenting topics from budget investments" do let(:investment) { create(:budget_investment) } describe "Moderators" do - scenario "can create comment as a moderator" do - community = investment.community - topic = create(:topic, community: community) - moderator = create(:moderator) - - login_as(moderator.user) - visit community_topic_path(community, topic) - - fill_in "Leave your comment", with: "I am moderating!" - check "comment-as-moderator-topic_#{topic.id}" - click_button "Publish comment" - - within "#comments" do - expect(page).to have_content "I am moderating!" - expect(page).to have_content "Moderator ##{moderator.id}" - expect(page).to have_css "div.is-moderator" - expect(page).to have_css "img.moderator-avatar" - end - end - scenario "can create reply as a moderator" do community = investment.community topic = create(:topic, community: community) diff --git a/spec/system/comments_spec.rb b/spec/system/comments_spec.rb index 40612d6c2..64481066f 100644 --- a/spec/system/comments_spec.rb +++ b/spec/system/comments_spec.rb @@ -400,6 +400,26 @@ describe "Comments" do end end + describe "Moderators" do + scenario "can create comment as a moderator" do + moderator = create(:moderator) + + login_as(moderator.user) + visit polymorphic_path(resource) + + fill_in fill_text, with: "I am moderating!" + check "Comment as moderator" + click_button button_text + + within "#comments" do + expect(page).to have_content "I am moderating!" + expect(page).to have_content "Moderator ##{moderator.id}" + expect(page).to have_css "div.is-moderator" + expect(page).to have_css "img.moderator-avatar" + end + end + end + scenario "Errors on create" do login_as(user) visit polymorphic_path(resource)