2016-01-21 17:06:09 +01:00
|
|
|
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
|
2021-02-01 14:28:04 +01:00
|
|
|
|
|
|
|
describe 'associate_user!' do
|
|
|
|
context 'when there is no user with same email' do
|
2021-04-26 16:26:42 +02:00
|
|
|
let(:fci) { build(:france_connect_information) }
|
2021-02-01 14:28:04 +01:00
|
|
|
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
|
2016-01-21 17:06:09 +01:00
|
|
|
end
|