Add link to comment path on comment date
This commit is contained in:
@@ -61,7 +61,12 @@
|
||||
|
||||
<% end %>
|
||||
|
||||
• <span><%= l comment.created_at.to_datetime, format: :datetime %></span>
|
||||
•
|
||||
<span>
|
||||
<%= link_to comment_path(comment) do %>
|
||||
<%= l comment.created_at.to_datetime, format: :datetime %>
|
||||
<% end %>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="comment-user
|
||||
|
||||
@@ -44,6 +44,21 @@ describe "Commenting Budget::Investments" do
|
||||
expect(page).to have_selector("ul#comment_#{second_child.id}>li", count: 1)
|
||||
end
|
||||
|
||||
scenario "Link to comment show" do
|
||||
comment = create(:comment, commentable: investment, user: user)
|
||||
|
||||
visit budget_investment_path(investment.budget, investment)
|
||||
|
||||
within "#comment_#{comment.id}" do
|
||||
expect(page).to have_link comment.created_at.strftime("%Y-%m-%d %T")
|
||||
end
|
||||
|
||||
click_link comment.created_at.strftime("%Y-%m-%d %T")
|
||||
|
||||
expect(page).to have_link "Go back to #{investment.title}"
|
||||
expect(page).to have_current_path(comment_path(comment))
|
||||
end
|
||||
|
||||
scenario "Collapsable comments", :js do
|
||||
parent_comment = create(:comment, body: "Main comment", commentable: investment)
|
||||
child_comment = create(:comment, body: "First subcomment", commentable: investment, parent: parent_comment)
|
||||
|
||||
@@ -39,6 +39,21 @@ describe "Commenting debates" do
|
||||
expect(page).to have_selector("ul#comment_#{second_child.id}>li", count: 1)
|
||||
end
|
||||
|
||||
scenario "Link to comment show" do
|
||||
comment = create(:comment, commentable: debate, user: user)
|
||||
|
||||
visit debate_path(debate)
|
||||
|
||||
within "#comment_#{comment.id}" do
|
||||
expect(page).to have_link comment.created_at.strftime("%Y-%m-%d %T")
|
||||
end
|
||||
|
||||
click_link comment.created_at.strftime("%Y-%m-%d %T")
|
||||
|
||||
expect(page).to have_link "Go back to #{debate.title}"
|
||||
expect(page).to have_current_path(comment_path(comment))
|
||||
end
|
||||
|
||||
scenario "Collapsable comments", :js do
|
||||
parent_comment = create(:comment, body: "Main comment", commentable: debate)
|
||||
child_comment = create(:comment, body: "First subcomment", commentable: debate, parent: parent_comment)
|
||||
|
||||
@@ -44,6 +44,22 @@ describe "Commenting legislation questions" do
|
||||
expect(page).to have_selector("ul#comment_#{second_child.id}>li", count: 1)
|
||||
end
|
||||
|
||||
scenario "Link to comment show" do
|
||||
comment = create(:comment, commentable: legislation_annotation, user: user)
|
||||
|
||||
visit legislation_process_draft_version_annotation_path(legislation_annotation.draft_version.process,
|
||||
legislation_annotation.draft_version,
|
||||
legislation_annotation)
|
||||
|
||||
within "#comment_#{comment.id}" do
|
||||
expect(page).to have_link comment.created_at.strftime("%Y-%m-%d %T")
|
||||
click_link comment.created_at.strftime("%Y-%m-%d %T")
|
||||
end
|
||||
|
||||
expect(page).to have_link "Go back to #{legislation_annotation.title}"
|
||||
expect(page).to have_current_path(comment_path(comment))
|
||||
end
|
||||
|
||||
scenario "Collapsable comments", :js do
|
||||
parent_comment = legislation_annotation.comments.first
|
||||
child_comment = create(:comment, body: "First subcomment", commentable: legislation_annotation, parent: parent_comment)
|
||||
|
||||
@@ -46,6 +46,21 @@ describe "Commenting legislation questions" do
|
||||
expect(page).to have_selector("ul#comment_#{second_child.id}>li", count: 1)
|
||||
end
|
||||
|
||||
scenario "Link to comment show" do
|
||||
comment = create(:comment, commentable: legislation_question, user: user)
|
||||
|
||||
visit legislation_process_question_path(legislation_question.process, legislation_question)
|
||||
|
||||
within "#comment_#{comment.id}" do
|
||||
expect(page).to have_link comment.created_at.strftime("%Y-%m-%d %T")
|
||||
end
|
||||
|
||||
click_link comment.created_at.strftime("%Y-%m-%d %T")
|
||||
|
||||
expect(page).to have_link "Go back to #{legislation_question.title}"
|
||||
expect(page).to have_current_path(comment_path(comment))
|
||||
end
|
||||
|
||||
scenario "Collapsable comments", :js do
|
||||
parent_comment = create(:comment, body: "Main comment", commentable: legislation_question)
|
||||
child_comment = create(:comment, body: "First subcomment", commentable: legislation_question, parent: parent_comment)
|
||||
|
||||
@@ -40,6 +40,21 @@ describe "Commenting polls" do
|
||||
expect(page).to have_selector("ul#comment_#{second_child.id}>li", count: 1)
|
||||
end
|
||||
|
||||
scenario "Link to comment show" do
|
||||
comment = create(:comment, commentable: poll, user: user)
|
||||
|
||||
visit poll_path(poll)
|
||||
|
||||
within "#comment_#{comment.id}" do
|
||||
expect(page).to have_link comment.created_at.strftime("%Y-%m-%d %T")
|
||||
end
|
||||
|
||||
click_link comment.created_at.strftime("%Y-%m-%d %T")
|
||||
|
||||
expect(page).to have_link "Go back to #{poll.title}"
|
||||
expect(page).to have_current_path(comment_path(comment))
|
||||
end
|
||||
|
||||
scenario "Collapsable comments", :js do
|
||||
parent_comment = create(:comment, body: "Main comment", commentable: poll)
|
||||
child_comment = create(:comment, body: "First subcomment", commentable: poll, parent: parent_comment)
|
||||
|
||||
@@ -38,6 +38,21 @@ describe "Commenting proposals" do
|
||||
expect(page).to have_selector("ul#comment_#{second_child.id}>li", count: 1)
|
||||
end
|
||||
|
||||
scenario "Link to comment show" do
|
||||
comment = create(:comment, commentable: proposal, user: user)
|
||||
|
||||
visit proposal_path(proposal)
|
||||
|
||||
within "#comment_#{comment.id}" do
|
||||
expect(page).to have_link comment.created_at.strftime("%Y-%m-%d %T")
|
||||
end
|
||||
|
||||
click_link comment.created_at.strftime("%Y-%m-%d %T")
|
||||
|
||||
expect(page).to have_link "Go back to #{proposal.title}"
|
||||
expect(page).to have_current_path(comment_path(comment))
|
||||
end
|
||||
|
||||
scenario "Collapsable comments", :js do
|
||||
parent_comment = create(:comment, body: "Main comment", commentable: proposal)
|
||||
child_comment = create(:comment, body: "First subcomment", commentable: proposal, parent: parent_comment)
|
||||
|
||||
@@ -39,6 +39,23 @@ describe "Commenting topics from proposals" do
|
||||
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)
|
||||
comment = create(:comment, commentable: topic, user: user)
|
||||
|
||||
visit community_topic_path(community, topic)
|
||||
|
||||
within "#comment_#{comment.id}" do
|
||||
expect(page).to have_link comment.created_at.strftime("%Y-%m-%d %T")
|
||||
end
|
||||
|
||||
click_link comment.created_at.strftime("%Y-%m-%d %T")
|
||||
|
||||
expect(page).to have_link "Go back to #{topic.title}"
|
||||
expect(page).to have_current_path(comment_path(comment))
|
||||
end
|
||||
|
||||
scenario "Collapsable comments", :js do
|
||||
community = proposal.community
|
||||
topic = create(:topic, community: community)
|
||||
|
||||
Reference in New Issue
Block a user