Maintenance: Invalid email error message is not expressive.
This commit is contained in:
parent
090fcb5408
commit
fbbc50f24a
5 changed files with 5 additions and 5 deletions
|
@ -100,7 +100,7 @@ class TicketsController < ApplicationController
|
||||||
email_address = $1
|
email_address = $1
|
||||||
email_address_validation = EmailAddressValidation.new(email_address)
|
email_address_validation = EmailAddressValidation.new(email_address)
|
||||||
if !email_address_validation.valid_format?
|
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
|
return
|
||||||
end
|
end
|
||||||
local_customer = User.find_by(email: email_address.downcase)
|
local_customer = User.find_by(email: email_address.downcase)
|
||||||
|
|
|
@ -50,7 +50,7 @@ check and if channel not exists reset configured channels for email addresses
|
||||||
self.email = email.downcase.strip
|
self.email = email.downcase.strip
|
||||||
email_address_validation = EmailAddressValidation.new(email)
|
email_address_validation = EmailAddressValidation.new(email)
|
||||||
if !email_address_validation.valid_format?
|
if !email_address_validation.valid_format?
|
||||||
raise Exceptions::UnprocessableEntity, 'Invalid email'
|
raise Exceptions::UnprocessableEntity, "Invalid email '#{email}'"
|
||||||
end
|
end
|
||||||
|
|
||||||
true
|
true
|
||||||
|
|
|
@ -962,7 +962,7 @@ try to find correct name
|
||||||
|
|
||||||
email_address_validation = EmailAddressValidation.new(email)
|
email_address_validation = EmailAddressValidation.new(email)
|
||||||
if !email_address_validation.valid_format?
|
if !email_address_validation.valid_format?
|
||||||
raise Exceptions::UnprocessableEntity, 'Invalid email'
|
raise Exceptions::UnprocessableEntity, "Invalid email '#{email}'"
|
||||||
end
|
end
|
||||||
|
|
||||||
true
|
true
|
||||||
|
|
|
@ -56,7 +56,7 @@ returns on fail
|
||||||
return {
|
return {
|
||||||
result: 'invalid',
|
result: 'invalid',
|
||||||
messages: {
|
messages: {
|
||||||
email: 'Invalid email.'
|
email: "Invalid email '#{params[:email]}'."
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
@ -309,7 +309,7 @@ RSpec.describe 'User', type: :request, searchindex: true do
|
||||||
post '/api/v1/users', params: params, as: :json
|
post '/api/v1/users', params: params, as: :json
|
||||||
expect(response).to have_http_status(:unprocessable_entity)
|
expect(response).to have_http_status(:unprocessable_entity)
|
||||||
expect(json_response).to be_truthy
|
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
|
# with valid attributes
|
||||||
params = { firstname: 'newfirstname123', note: 'some note' }
|
params = { firstname: 'newfirstname123', note: 'some note' }
|
||||||
|
|
Loading…
Reference in a new issue