use the with_user trait in feature
This commit is contained in:
parent
1cf59f722e
commit
9dc9e92c16
1 changed files with 26 additions and 13 deletions
|
@ -33,8 +33,14 @@ feature 'France Connect Particulier Connexion' do
|
|||
let(:code) { 'plop' }
|
||||
|
||||
context 'when authentification is ok' do
|
||||
before do
|
||||
allow_any_instance_of(FranceConnectParticulierClient).to receive(:authorization_uri).and_return(france_connect_particulier_callback_path(code: code))
|
||||
allow(FranceConnectService).to receive(:retrieve_user_informations_particulier).and_return(france_connect_information)
|
||||
end
|
||||
|
||||
context 'when is the first connexion' do
|
||||
let(:france_connect_information) do
|
||||
create(:france_connect_information,
|
||||
build(:france_connect_information,
|
||||
france_connect_particulier_id: france_connect_particulier_id,
|
||||
given_name: given_name,
|
||||
family_name: family_name,
|
||||
|
@ -44,12 +50,6 @@ feature 'France Connect Particulier Connexion' do
|
|||
email_france_connect: email)
|
||||
end
|
||||
|
||||
before do
|
||||
allow_any_instance_of(FranceConnectParticulierClient).to receive(:authorization_uri).and_return(france_connect_particulier_callback_path(code: code))
|
||||
allow(FranceConnectService).to receive(:retrieve_user_informations_particulier).and_return(FranceConnectInformation.new(user_info))
|
||||
end
|
||||
|
||||
context 'when is the first connexion' do
|
||||
before do
|
||||
page.find('.france-connect-login-button').click
|
||||
end
|
||||
|
@ -60,8 +60,21 @@ feature 'France Connect Particulier Connexion' do
|
|||
end
|
||||
|
||||
context 'when is not the first connexion' do
|
||||
let!(:france_connect_information) do
|
||||
create(:france_connect_information,
|
||||
:with_user,
|
||||
france_connect_particulier_id: france_connect_particulier_id,
|
||||
given_name: given_name,
|
||||
family_name: family_name,
|
||||
birthdate: birthdate,
|
||||
birthplace: birthplace,
|
||||
gender: gender,
|
||||
email_france_connect: email,
|
||||
created_at: Time.zone.parse('12/12/2012'),
|
||||
updated_at: Time.zone.parse('12/12/2012'))
|
||||
end
|
||||
|
||||
before do
|
||||
create(:user, france_connect_information: france_connect_information)
|
||||
page.find('.france-connect-login-button').click
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue