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