From b9ec40325cd04f82afc7e02c793e6a4635d2c67d Mon Sep 17 00:00:00 2001 From: Julian Herrero Date: Mon, 13 Jun 2022 16:16:07 +0200 Subject: [PATCH] Fix link to comments on admin view for debates --- app/views/admin/debates/show.html.erb | 2 +- spec/system/admin/debates_spec.rb | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/views/admin/debates/show.html.erb b/app/views/admin/debates/show.html.erb index 7a60a117b..3319a11cb 100644 --- a/app/views/admin/debates/show.html.erb +++ b/app/views/admin/debates/show.html.erb @@ -18,7 +18,7 @@ <%= l @debate.created_at.to_date %>  •    - <%= link_to t("debates.show.comments", count: @debate.comments_count), "#comments" %> + <%= link_to t("debates.show.comments", count: @debate.comments_count), debate_path(@debate, anchor: "comments") %>  •  <%= render "shared/flag_actions", flaggable: @debate %> diff --git a/spec/system/admin/debates_spec.rb b/spec/system/admin/debates_spec.rb index bb42b6dfa..80ee3e548 100644 --- a/spec/system/admin/debates_spec.rb +++ b/spec/system/admin/debates_spec.rb @@ -19,4 +19,14 @@ describe "Admin debates", :admin do expect(page).to have_content(debate.title) expect(page).to have_content(debate.description) end + + scenario "Comments link" do + debate = create(:debate) + comment = create(:comment, commentable: debate) + + visit admin_debate_path(debate) + click_link "1 comment" + + expect(page).to have_content(comment.body) + end end