6826bf03b0
instead of looking linked user by email because : - follows FC recommendation to fetch ds account by openid - the email is not a valid key as many user can share the same FCI email. The following scenario is now working A user A (email: 1@mail.com) uses FC to connect to DS => It is connected as 1@mail.com Another user B (email: generic@mail.com) uses FC to connect => It is connected as generic@mail.com The first user A change its FC email to generic@mail.com and connect to DS => It is still connected as 1@mail.com
22 lines
773 B
Ruby
22 lines
773 B
Ruby
describe FranceConnectInformation, type: :model do
|
|
describe 'validation' do
|
|
context 'france_connect_particulier_id' do
|
|
it { is_expected.not_to allow_value(nil).for(:france_connect_particulier_id) }
|
|
it { is_expected.not_to allow_value('').for(:france_connect_particulier_id) }
|
|
it { is_expected.to allow_value('mon super projet').for(:france_connect_particulier_id) }
|
|
end
|
|
end
|
|
|
|
describe 'associate_user!' do
|
|
context 'when there is no user with same email' do
|
|
let(:fci) { build(:france_connect_information) }
|
|
let(:subject) { fci.associate_user! }
|
|
|
|
it { expect { subject }.to change(User, :count).by(1) }
|
|
it do
|
|
subject
|
|
expect(fci.user.email).to eq(fci.email_france_connect)
|
|
end
|
|
end
|
|
end
|
|
end
|