From 1d29209264ed5ddf3972cc1766c88e0b509c4aed Mon Sep 17 00:00:00 2001 From: James Mead Date: Tue, 21 Nov 2023 14:18:59 +0000 Subject: [PATCH] Fixes for edit user name & email form actions The `#user_name_path` & `#user_email_path` route helper methods should require a `user` argument. However, the argument was not provided in either of the PRs where these forms were added (#2497 & #2509). The assertions in `Users::NamesControllerTest` & `Users::EmailsControllerTest` were already comparing with the correct values and *somehow* the calls to `#user_name_path` & `#user_email_path` without any arguments were magically returning the correct value, even though when I try them in a Rails console, I get an `ActionController::UrlGenerationError`. So this mistake wasn't actually causing any problems. --- app/views/users/emails/edit.html.erb | 2 +- app/views/users/names/edit.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/users/emails/edit.html.erb b/app/views/users/emails/edit.html.erb index a2e089b79..b200bd04d 100644 --- a/app/views/users/emails/edit.html.erb +++ b/app/views/users/emails/edit.html.erb @@ -51,7 +51,7 @@
- <%= form_for @user, url: user_email_path do %> + <%= form_for @user, url: user_email_path(@user) do %> <%= render "govuk_publishing_components/components/input", { label: { text: "Email" diff --git a/app/views/users/names/edit.html.erb b/app/views/users/names/edit.html.erb index acac9a7ed..6ee94098c 100644 --- a/app/views/users/names/edit.html.erb +++ b/app/views/users/names/edit.html.erb @@ -40,7 +40,7 @@
- <%= form_for @user, url: user_name_path do |f| %> + <%= form_for @user, url: user_name_path(@user) do |f| %> <%= render "govuk_publishing_components/components/input", { label: { text: "Name"