Browse Source

Test error message

pull/158/head
baarkerlounger 4 years ago
parent
commit
e6a0e854a2
  1. 2
      app/controllers/users_controller.rb
  2. 1
      spec/requests/user_controller_spec.rb

2
app/controllers/users_controller.rb

@ -46,7 +46,7 @@ class UsersController < ApplicationController
private
def format_error_messages
errors = @user.errors.to_h
errors = @user.errors.to_hash
@user.errors.clear
errors.each do |attribute, message|
@user.errors.add attribute.to_sym, format_error_message(attribute, message)

1
spec/requests/user_controller_spec.rb

@ -60,6 +60,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")
end
end
end

Loading…
Cancel
Save