From 5346a5e2da21f90a7a19ff37fa9308e9d8987783 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Thu, 15 May 2025 13:10:15 +0300 Subject: [PATCH] Add new diary entry links to user's own diary entry pages --- app/views/diary_entries/show.html.erb | 2 +- test/system/diary_entry_test.rb | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/app/views/diary_entries/show.html.erb b/app/views/diary_entries/show.html.erb index 59dba0fe6..d92f77973 100644 --- a/app/views/diary_entries/show.html.erb +++ b/app/views/diary_entries/show.html.erb @@ -9,7 +9,7 @@

<%= link_to t(".user_title", :user => @diary_entry.user.display_name), :action => :index %>

-

<%= rss_link_to :action => :rss, :display_name => @diary_entry.user.display_name %>

+ <%= render :partial => "navigation" %>
<% end %> diff --git a/test/system/diary_entry_test.rb b/test/system/diary_entry_test.rb index 1cf72c964..36cc73f9e 100644 --- a/test/system/diary_entry_test.rb +++ b/test/system/diary_entry_test.rb @@ -75,6 +75,30 @@ class DiaryEntrySystemTest < ApplicationSystemTestCase assert_no_link "Diary Entries in Russian" end + test "should have new diary entry link on own diary entry page" do + user = create(:user) + diary_entry = create(:diary_entry, :user => user) + + sign_in_as(user) + visit diary_entry_path(diary_entry.user, diary_entry) + + within_content_heading do + assert_link "New Diary Entry" + end + end + + test "should not have new diary entry link on other user's diary entry page" do + user = create(:user) + diary_entry = create(:diary_entry) + + sign_in_as(user) + visit diary_entry_path(diary_entry.user, diary_entry) + + within_content_heading do + assert_no_link "New Diary Entry" + end + end + test "should not be hidden on the list page" do body = SecureRandom.alphanumeric(1998) create(:diary_entry, :body => body) -- 2.39.5