Maintenance: Invalid email error message is not expressive.

This commit is contained in:
Thorsten Eckel 2020-01-31 22:40:55 +01:00
parent 090fcb5408
commit fbbc50f24a
5 changed files with 5 additions and 5 deletions

View file

@ -100,7 +100,7 @@ class TicketsController < ApplicationController
email_address = $1
email_address_validation = EmailAddressValidation.new(email_address)
if !email_address_validation.valid_format?
render json: { error: 'Invalid email of customer' }, status: :unprocessable_entity
render json: { error: "Invalid email '#{email_address}' of customer" }, status: :unprocessable_entity
return
end
local_customer = User.find_by(email: email_address.downcase)

View file

@ -50,7 +50,7 @@ check and if channel not exists reset configured channels for email addresses
self.email = email.downcase.strip
email_address_validation = EmailAddressValidation.new(email)
if !email_address_validation.valid_format?
raise Exceptions::UnprocessableEntity, 'Invalid email'
raise Exceptions::UnprocessableEntity, "Invalid email '#{email}'"
end
true

View file

@ -962,7 +962,7 @@ try to find correct name
email_address_validation = EmailAddressValidation.new(email)
if !email_address_validation.valid_format?
raise Exceptions::UnprocessableEntity, 'Invalid email'
raise Exceptions::UnprocessableEntity, "Invalid email '#{email}'"
end
true

View file

@ -56,7 +56,7 @@ returns on fail
return {
result: 'invalid',
messages: {
email: 'Invalid email.'
email: "Invalid email '#{params[:email]}'."
},
}
end

View file

@ -309,7 +309,7 @@ RSpec.describe 'User', type: :request, searchindex: true do
post '/api/v1/users', params: params, as: :json
expect(response).to have_http_status(:unprocessable_entity)
expect(json_response).to be_truthy
expect(json_response['error']).to eq('Invalid email')
expect(json_response['error']).to eq("Invalid email 'some_what'")
# with valid attributes
params = { firstname: 'newfirstname123', note: 'some note' }