specs: fix the sign-up with unconfirmed account test
It was testing the sign-in instead of the sign-up.
This commit is contained in:
parent
e746d90016
commit
a8444927ab
1 changed files with 14 additions and 17 deletions
|
@ -91,27 +91,24 @@ feature 'Signing up:' do
|
|||
end
|
||||
end
|
||||
|
||||
context 'when a user is not confirmed yet' do
|
||||
context 'when the user is not confirmed yet' do
|
||||
before do
|
||||
visit commencer_path(path: procedure.path)
|
||||
click_on 'Créer un compte demarches-simplifiees.fr'
|
||||
|
||||
sign_up_with user_email, user_password
|
||||
create(:user, :unconfirmed, email: user_email, password: user_password)
|
||||
end
|
||||
|
||||
# Ideally, when signing-in with an unconfirmed account,
|
||||
# the user would be redirected to the "resend email confirmation" page.
|
||||
#
|
||||
# However the check for unconfirmed accounts is made by Warden every time a page is loaded –
|
||||
# and much earlier than SessionsController#create.
|
||||
#
|
||||
# For now only test the default behavior (an error message is displayed).
|
||||
scenario 'they get an error message' do
|
||||
visit root_path
|
||||
click_on 'Connexion'
|
||||
scenario 'the email confirmation page is displayed' do
|
||||
visit commencer_path(path: procedure.path)
|
||||
click_on 'Créer un compte'
|
||||
|
||||
sign_in_with user_email, user_password
|
||||
expect(page).to have_content 'Vous devez confirmer votre adresse email pour continuer'
|
||||
sign_up_with user_email, user_password
|
||||
|
||||
# The same page than for initial sign-ups is displayed, to avoid leaking informations
|
||||
# about the accound existence.
|
||||
expect(page).to have_content "nous avons besoin de vérifier votre adresse #{user_email}"
|
||||
|
||||
# The confirmation email is sent again
|
||||
confirmation_email = open_email(user_email)
|
||||
expect(confirmation_email.body).to have_text('Pour activer votre compte')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue