Skip to content

Commit

Permalink
Fixes for edit user name & email form actions
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
floehopper committed Nov 21, 2023
1 parent 6d482dc commit 1d29209
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/views/users/emails/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= 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"
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/names/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

<div class="govuk-grid-row">
<div class="govuk-grid-column-two-thirds">
<%= 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"
Expand Down

0 comments on commit 1d29209

Please sign in to comment.