diff --git a/app/presenters/error_summary_full_messages_presenter.rb b/app/presenters/error_summary_full_messages_presenter.rb deleted file mode 100644 index e499b287e..000000000 --- a/app/presenters/error_summary_full_messages_presenter.rb +++ /dev/null @@ -1,11 +0,0 @@ -class ErrorSummaryFullMessagesPresenter - def initialize(error_messages) - @error_messages = error_messages - end - - def formatted_error_messages - @error_messages.map do |attribute, messages| - [attribute, [attribute.to_s.humanize, messages.first].join(" ")] - end - end -end diff --git a/app/views/devise/passwords/edit.html.erb b/app/views/devise/passwords/edit.html.erb index 579eb64c6..7d6babca3 100644 --- a/app/views/devise/passwords/edit.html.erb +++ b/app/views/devise/passwords/edit.html.erb @@ -10,7 +10,7 @@ <%= form_for(resource, as: resource_name, html: { method: :patch }) do |f| %>
- <%= f.govuk_error_summary(presenter: ErrorSummaryFullMessagesPresenter) %> + <%= f.govuk_error_summary %>

<%= content_for(:title) %> diff --git a/config/locales/devise.en.yml b/config/locales/devise.en.yml index a41f253fa..a0a6ad4ff 100644 --- a/config/locales/devise.en.yml +++ b/config/locales/devise.en.yml @@ -57,8 +57,10 @@ en: errors: messages: already_confirmed: "has already been confirmed. Sign in." + blank: "can’t be blank" + confirmation: "doesn’t match new password" confirmation_period_expired: "needs to be confirmed within %{period}. Request a new account." - expired: "has expired. Request a new token." + expired: "Token has expired. Request a new token." not_found: "was not found" not_locked: "has not been locked" not_saved: diff --git a/spec/models/organisation_spec.rb b/spec/models/organisation_spec.rb index f94782b1d..adfb40f68 100644 --- a/spec/models/organisation_spec.rb +++ b/spec/models/organisation_spec.rb @@ -15,7 +15,7 @@ RSpec.describe Organisation, type: :model do it "validates provider_type presence" do expect { FactoryBot.create(:organisation, provider_type: nil) } - .to raise_error(ActiveRecord::RecordInvalid, "Validation failed: Provider type can't be blank") + .to raise_error(ActiveRecord::RecordInvalid, "Validation failed: Provider type can’t be blank") end context "with data protection confirmations" do diff --git a/spec/presenters/error_summary_full_messages_presenter_spec.rb b/spec/presenters/error_summary_full_messages_presenter_spec.rb deleted file mode 100644 index 4535eebe3..000000000 --- a/spec/presenters/error_summary_full_messages_presenter_spec.rb +++ /dev/null @@ -1,12 +0,0 @@ -require "rails_helper" - -RSpec.describe ErrorSummaryFullMessagesPresenter do - subject(:error_summary_presenter) { described_class.new(error_messages) } - - let(:error_messages) { { reset_password_token: %w[expired] } } - let(:formatted_error_messages) { [[:reset_password_token, "Reset password token expired"]] } - - it "formats messages to include the attribute name" do - expect(error_summary_presenter.formatted_error_messages).to eq(formatted_error_messages) - end -end diff --git a/spec/requests/auth/passwords_controller_spec.rb b/spec/requests/auth/passwords_controller_spec.rb index 0adff32f5..3bb285244 100644 --- a/spec/requests/auth/passwords_controller_spec.rb +++ b/spec/requests/auth/passwords_controller_spec.rb @@ -106,7 +106,7 @@ RSpec.describe Auth::PasswordsController, type: :request do it "shows an error" do put "/admin/password", headers: headers, params: params expect(response).to have_http_status(:unprocessable_entity) - expect(page).to have_content("doesn't match Password") + expect(page).to have_content("doesn’t match new password") end end @@ -178,7 +178,7 @@ RSpec.describe Auth::PasswordsController, type: :request do it "shows an error" do put "/account/password", headers: headers, params: params expect(response).to have_http_status(:unprocessable_entity) - expect(page).to have_content("doesn't match Password") + expect(page).to have_content("doesn’t match new password") end end diff --git a/spec/requests/users_controller_spec.rb b/spec/requests/users_controller_spec.rb index b75cc5b4f..cb7a5a12f 100644 --- a/spec/requests/users_controller_spec.rb +++ b/spec/requests/users_controller_spec.rb @@ -69,7 +69,7 @@ RSpec.describe UsersController, type: :request do it "shows an error if passwords don't match" do expect(response).to have_http_status(:unprocessable_entity) expect(page).to have_selector("#error-summary-title") - expect(page).to have_content("Password confirmation doesn't match Password") + expect(page).to have_content("Password confirmation doesn’t match new password") end end