add explanation to spec login

This commit is contained in:
pedong 2019-05-13 11:57:01 +02:00 committed by Pierre de La Morinerie
parent a226999382
commit b1f11c0b0a

View file

@ -74,8 +74,13 @@ describe Users::RegistrationsController, type: :controller do
before { subject }
it { expect(response).to redirect_to(new_user_confirmation_path(user: { email: user[:email] })) }
it { expect(UserMailer).to have_received(:new_account_warning) }
it 'sends an email to the user, stating that the account already exists' do
expect(UserMailer).to have_received(:new_account_warning)
end
it 'avoids leaking information about the account existence, by redirecting to the same page than normal signup' do
expect(response).to redirect_to(new_user_confirmation_path(user: { email: user[:email] }))
end
end
context 'and the user is not confirmed' do
@ -86,8 +91,13 @@ describe Users::RegistrationsController, type: :controller do
subject
end
it { expect(response).to redirect_to(new_user_confirmation_path(user: { email: user[:email] })) }
it { expect(UserMailer).not_to have_received(:new_account_warning) }
it 'does not send a warning email' do
expect(UserMailer).not_to have_received(:new_account_warning)
end
it 'avoids leaking information about the account existence, by redirecting to the same page than normal signup' do
expect(response).to redirect_to(new_user_confirmation_path(user: { email: user[:email] }))
end
end
end
end