Unify show comments specs
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user