diff --git a/app/views/news/show.html.erb b/app/views/news/show.html.erb index 701412bedb5..0c69446543c 100644 --- a/app/views/news/show.html.erb +++ b/app/views/news/show.html.erb @@ -47,7 +47,7 @@ See COPYRIGHT and LICENSE files for more details. mobile_icon: :pencil, mobile_label: t(:button_edit), size: :medium, - href: edit_project_news_path(@news), + href: edit_project_news_path(@project, @news), aria: { label: I18n.t(:button_edit) }, title: I18n.t(:button_edit) ) do |button| diff --git a/spec/controllers/news_controller_spec.rb b/spec/controllers/news_controller_spec.rb index c4d262c6d81..d474bb9dfcb 100644 --- a/spec/controllers/news_controller_spec.rb +++ b/spec/controllers/news_controller_spec.rb @@ -103,6 +103,12 @@ RSpec.describe NewsController do expect(response).to be_not_found end + + it "renders edit link with correct project identifier" do + get :show, params: { project_id: news.project_id, id: news.id } + + expect(response.body).to include edit_project_news_path(project, news) + end end end