Ignore case from input email (#424)
This commit is contained in:
@@ -79,6 +79,21 @@ RSpec.describe '/api/v1/widget/messages', type: :request do
|
||||
message.reload
|
||||
expect { contact.reload }.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
|
||||
it 'ignores the casing of email, updates message in conversation and deletes the current contact' do
|
||||
message = create(:message, account: account, inbox: web_widget.inbox, conversation: conversation)
|
||||
email = Faker::Internet.email
|
||||
create(:contact, account: account, email: email)
|
||||
contact_params = { email: email.upcase }
|
||||
put api_v1_widget_message_url(message.id),
|
||||
params: { website_token: web_widget.website_token, contact: contact_params },
|
||||
headers: { 'X-Auth-Token' => token },
|
||||
as: :json
|
||||
|
||||
expect(response).to have_http_status(:success)
|
||||
message.reload
|
||||
expect { contact.reload }.to raise_error(ActiveRecord::RecordNotFound)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user