-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reconnaît les e-mails InclusionConnect indépendamment de la casse
https://app.rollbar.com/a/eva-betagouv/fix/item/eva/850 Cas d'un compte existant dans eva, mais enregistré chez inclusion connect avec une casse différente.
- Loading branch information
1 parent
a9217db
commit 2d0f1eb
Showing
2 changed files
with
78 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,7 +68,80 @@ | |
end | ||
end | ||
|
||
context 'le compte existe déjà en base avec id inclusion connect' do | ||
context 'le compte existe déjà en base sans id inclusion connect, email avec majuscule' do | ||
before do | ||
create :compte_admin, email: email | ||
end | ||
|
||
it do | ||
Timecop.freeze(aujourdhui) do | ||
compte = described_class.cree_ou_recupere_compte({ | ||
'sub' => id_ic, | ||
'email' => '[email protected]', | ||
'given_name' => 'prénom', | ||
'family_name' => 'nom' | ||
}) | ||
expect(compte).not_to be_nil | ||
expect(compte.email).to eq(email) | ||
expect(compte.prenom).to eq('prénom') | ||
expect(compte.nom).to eq('nom') | ||
expect(compte.confirmed_at).to eq(aujourdhui) | ||
expect(compte.password).to be_nil | ||
expect(compte.id_inclusion_connect).to eq(id_ic) | ||
end | ||
end | ||
end | ||
|
||
context 'le compte existe déjà en base même email, mais effacé' do | ||
before do | ||
create :compte_admin, email: email, confirmed_at: hier, deleted_at: hier | ||
end | ||
|
||
it do | ||
Timecop.freeze(aujourdhui) do | ||
compte = described_class.cree_ou_recupere_compte({ | ||
'sub' => id_ic, | ||
'email' => email, | ||
'given_name' => 'prénom', | ||
'family_name' => 'nom' | ||
}) | ||
expect(compte).not_to be_nil | ||
expect(compte.prenom).to eq('prénom') | ||
expect(compte.nom).to eq('nom') | ||
expect(compte.email).to eq(email) | ||
expect(compte.confirmed_at).to eq(aujourdhui) | ||
expect(compte.password).not_to be_nil | ||
expect(compte.id_inclusion_connect).to eq(id_ic) | ||
expect(compte.id).not_to eq(Compte.only_deleted.find_by(email: email).id) | ||
end | ||
end | ||
end | ||
|
||
context 'le compte existe déjà en base avec id inclusion connect, même email' do | ||
before do | ||
create :compte_admin, email: email, confirmed_at: hier, id_inclusion_connect: id_ic | ||
end | ||
|
||
it do | ||
Timecop.freeze(aujourdhui) do | ||
compte = described_class.cree_ou_recupere_compte({ | ||
'sub' => id_ic, | ||
'email' => email, | ||
'given_name' => 'prénom', | ||
'family_name' => 'nom' | ||
}) | ||
expect(compte).not_to be_nil | ||
expect(compte.prenom).to eq('prénom') | ||
expect(compte.nom).to eq('nom') | ||
expect(compte.email).to eq(email) | ||
expect(compte.confirmed_at).to eq(hier) | ||
expect(compte.password).to be_nil | ||
expect(compte.id_inclusion_connect).to eq(id_ic) | ||
end | ||
end | ||
end | ||
|
||
context 'le compte existe déjà en base avec id inclusion connect, email différent' do | ||
before do | ||
create :compte_admin, email: ancien_email, confirmed_at: hier, id_inclusion_connect: id_ic | ||
end | ||
|