diff --git a/spec/system/comments/budget_investments_spec.rb b/spec/system/comments/budget_investments_spec.rb index c5fcb422e..0f2a15e81 100644 --- a/spec/system/comments/budget_investments_spec.rb +++ b/spec/system/comments/budget_investments_spec.rb @@ -6,26 +6,6 @@ describe "Commenting Budget::Investments" do it_behaves_like "flaggable", :budget_investment_comment - scenario "Show" do - parent_comment = create(:comment, commentable: investment, body: "Parent") - create(:comment, commentable: investment, parent: parent_comment, body: "First subcomment") - create(:comment, commentable: investment, parent: parent_comment, body: "Last subcomment") - - visit comment_path(parent_comment) - - expect(page).to have_css(".comment", count: 3) - expect(page).to have_content "Parent" - expect(page).to have_content "First subcomment" - expect(page).to have_content "Last subcomment" - - expect(page).to have_link "Go back to #{investment.title}", - href: budget_investment_path(investment.budget, investment) - - within ".comment", text: "Parent" do - expect(page).to have_css ".comment", count: 2 - end - end - scenario "Link to comment show" do comment = create(:comment, commentable: investment, user: user) diff --git a/spec/system/comments/debates_spec.rb b/spec/system/comments/debates_spec.rb index 9a8b64761..58db0c99e 100644 --- a/spec/system/comments/debates_spec.rb +++ b/spec/system/comments/debates_spec.rb @@ -6,25 +6,6 @@ describe "Commenting debates" do it_behaves_like "flaggable", :debate_comment - scenario "Show" do - parent_comment = create(:comment, commentable: debate, body: "Parent") - create(:comment, commentable: debate, parent: parent_comment, body: "First subcomment") - create(:comment, commentable: debate, parent: parent_comment, body: "Last subcomment") - - visit comment_path(parent_comment) - - expect(page).to have_css(".comment", count: 3) - expect(page).to have_content "Parent" - expect(page).to have_content "First subcomment" - expect(page).to have_content "Last subcomment" - - expect(page).to have_link "Go back to #{debate.title}", href: debate_path(debate) - - within ".comment", text: "Parent" do - expect(page).to have_css ".comment", count: 2 - end - end - scenario "Link to comment show" do comment = create(:comment, commentable: debate, user: user) diff --git a/spec/system/comments/legislation_annotations_spec.rb b/spec/system/comments/legislation_annotations_spec.rb index ff3a228f7..75651d10d 100644 --- a/spec/system/comments/legislation_annotations_spec.rb +++ b/spec/system/comments/legislation_annotations_spec.rb @@ -6,26 +6,6 @@ describe "Commenting legislation questions" do it_behaves_like "flaggable", :legislation_annotation_comment - scenario "Show" do - href = polymorphic_path(annotation) - parent_comment = create(:comment, commentable: annotation, body: "Parent") - create(:comment, commentable: annotation, parent: parent_comment, body: "First subcomment") - create(:comment, commentable: annotation, parent: parent_comment, body: "Last subcomment") - - visit comment_path(parent_comment) - - expect(page).to have_css(".comment", count: 3) - expect(page).to have_content "Parent" - expect(page).to have_content "First subcomment" - expect(page).to have_content "Last subcomment" - - expect(page).to have_link "Go back to #{annotation.title}", href: href - - within ".comment", text: "Parent" do - expect(page).to have_css ".comment", count: 2 - end - end - scenario "Link to comment show" do comment = create(:comment, commentable: annotation, user: user) diff --git a/spec/system/comments/legislation_questions_spec.rb b/spec/system/comments/legislation_questions_spec.rb index 30affdcf0..4a542df4f 100644 --- a/spec/system/comments/legislation_questions_spec.rb +++ b/spec/system/comments/legislation_questions_spec.rb @@ -10,26 +10,6 @@ describe "Commenting legislation questions" do it_behaves_like "flaggable", :legislation_question_comment end - scenario "Show" do - href = legislation_process_question_path(question.process, question) - parent_comment = create(:comment, commentable: question, body: "Parent") - create(:comment, commentable: question, parent: parent_comment, body: "First subcomment") - create(:comment, commentable: question, parent: parent_comment, body: "Last subcomment") - - visit comment_path(parent_comment) - - expect(page).to have_css(".comment", count: 3) - expect(page).to have_content "Parent" - expect(page).to have_content "First subcomment" - expect(page).to have_content "Last subcomment" - - expect(page).to have_link "Go back to #{question.title}", href: href - - within ".comment", text: "Parent" do - expect(page).to have_css ".comment", count: 2 - end - end - scenario "Link to comment show" do comment = create(:comment, commentable: question, user: user) diff --git a/spec/system/comments/polls_spec.rb b/spec/system/comments/polls_spec.rb index 23d1b9f38..46c4b90f8 100644 --- a/spec/system/comments/polls_spec.rb +++ b/spec/system/comments/polls_spec.rb @@ -4,24 +4,6 @@ describe "Commenting polls" do let(:user) { create(:user) } let(:poll) { create(:poll, author: create(:user)) } - scenario "Show" do - parent_comment = create(:comment, commentable: poll, body: "Parent") - create(:comment, commentable: poll, parent: parent_comment, body: "First subcomment") - create(:comment, commentable: poll, parent: parent_comment, body: "Last subcomment") - - visit comment_path(parent_comment) - - expect(page).to have_css ".comment", count: 3 - expect(page).to have_content "Parent" - expect(page).to have_content "First subcomment" - expect(page).to have_content "Last subcomment" - expect(page).to have_link "Go back to #{poll.name}", href: poll_path(poll) - - within ".comment", text: "Parent" do - expect(page).to have_css ".comment", count: 2 - end - end - scenario "Link to comment show" do comment = create(:comment, commentable: poll, user: user) diff --git a/spec/system/comments/proposals_spec.rb b/spec/system/comments/proposals_spec.rb index 9606219e0..4a7ba282b 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 - scenario "Show" do - parent_comment = create(:comment, commentable: proposal, body: "Parent") - create(:comment, commentable: proposal, parent: parent_comment, body: "First subcomment") - create(:comment, commentable: proposal, parent: parent_comment, body: "Last subcomment") - - visit comment_path(parent_comment) - - expect(page).to have_css(".comment", count: 3) - expect(page).to have_content "Parent" - expect(page).to have_content "First subcomment" - expect(page).to have_content "Last subcomment" - expect(page).to have_link "Go back to #{proposal.title}", href: proposal_path(proposal) - - within ".comment", text: "Parent" do - expect(page).to have_css ".comment", count: 2 - end - end - scenario "Link to comment show" do comment = create(:comment, commentable: proposal, user: user) diff --git a/spec/system/comments/topics_spec.rb b/spec/system/comments/topics_spec.rb index 858922cd7..528e30362 100644 --- a/spec/system/comments/topics_spec.rb +++ b/spec/system/comments/topics_spec.rb @@ -6,23 +6,6 @@ describe "Commenting topics from proposals" do it_behaves_like "flaggable", :topic_with_community_comment - scenario "Show" do - community = proposal.community - topic = create(:topic, community: community) - parent_comment = create(:comment, commentable: topic) - first_child = create(:comment, commentable: topic, parent: parent_comment) - second_child = create(:comment, commentable: topic, parent: parent_comment) - - visit comment_path(parent_comment) - - expect(page).to have_css(".comment", count: 3) - expect(page).to have_content parent_comment.body - expect(page).to have_content first_child.body - expect(page).to have_content second_child.body - - expect(page).to have_link "Go back to #{topic.title}", href: community_topic_path(community, topic) - end - scenario "Link to comment show" do community = proposal.community topic = create(:topic, community: community) @@ -532,23 +515,6 @@ describe "Commenting topics from budget investments" do let(:user) { create(:user) } let(:investment) { create(:budget_investment) } - scenario "Show" do - community = investment.community - topic = create(:topic, community: community) - parent_comment = create(:comment, commentable: topic) - first_child = create(:comment, commentable: topic, parent: parent_comment) - second_child = create(:comment, commentable: topic, parent: parent_comment) - - visit comment_path(parent_comment) - - expect(page).to have_css(".comment", count: 3) - expect(page).to have_content parent_comment.body - expect(page).to have_content first_child.body - expect(page).to have_content second_child.body - - expect(page).to have_link "Go back to #{topic.title}", href: community_topic_path(community, topic) - end - scenario "Collapsable comments" do community = investment.community topic = create(:topic, community: community) diff --git a/spec/system/comments_spec.rb b/spec/system/comments_spec.rb index b06822b94..a31afbb45 100644 --- a/spec/system/comments_spec.rb +++ b/spec/system/comments_spec.rb @@ -83,6 +83,26 @@ describe "Comments" do end end + scenario "Show" do + parent_comment = create(:comment, commentable: resource, body: "Parent") + create(:comment, commentable: resource, parent: parent_comment, body: "First subcomment") + create(:comment, commentable: resource, parent: parent_comment, body: "Last subcomment") + + visit comment_path(parent_comment) + + expect(page).to have_css(".comment", count: 3) + expect(page).to have_content "Parent" + expect(page).to have_content "First subcomment" + expect(page).to have_content "Last subcomment" + + expect(page).to have_link "Go back to #{resource.title}", + href: polymorphic_path(resource) + + within ".comment", text: "Parent" do + expect(page).to have_css ".comment", count: 2 + end + end + describe "Not logged user" do scenario "can not see comments forms" do create(:comment, commentable: resource)