downcase on email adresse for invite object
This commit is contained in:
parent
51c145d2ce
commit
000fadf501
2 changed files with 10 additions and 1 deletions
|
@ -3,7 +3,7 @@ class InvitesController < ApplicationController
|
|||
email_sender = current_gestionnaire.email
|
||||
|
||||
user = User.find_by_email(params[:email])
|
||||
invite = Invite.create(dossier_id: params[:dossier_id], user: user, email: params[:email], email_sender: email_sender)
|
||||
invite = Invite.create(dossier_id: params[:dossier_id], user: user, email: params[:email].downcase, email_sender: email_sender)
|
||||
|
||||
if invite.valid?
|
||||
InviteMailer.invite_user(invite).deliver_now! unless invite.user.nil?
|
||||
|
|
|
@ -22,6 +22,15 @@ describe InvitesController, type: :controller do
|
|||
subject
|
||||
end
|
||||
|
||||
describe 'Invite information' do
|
||||
let(:email) { 'PLIP@octo.com' }
|
||||
let(:invite) { Invite.last }
|
||||
|
||||
it 'email is on lower case' do
|
||||
expect(invite.email).to eq 'plip@octo.com'
|
||||
end
|
||||
end
|
||||
|
||||
it { expect(invite.user).to eq user }
|
||||
it { expect(flash[:notice]).to be_present }
|
||||
|
||||
|
|
Loading…
Reference in a new issue