Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-02-11 15:08:52 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-02-11 15:08:52 +0300
commit05b5c609cb8c260b10c2eb1b92b711dc82d32c3f (patch)
tree05253c66806b17c5b1f9f13addab59524d536fc4 /spec/controllers
parent1078b7bf25c2cb6e03c57da9ae25b0512858556f (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/registrations_controller_spec.rb28
1 files changed, 23 insertions, 5 deletions
diff --git a/spec/controllers/registrations_controller_spec.rb b/spec/controllers/registrations_controller_spec.rb
index e36d87a7224..8d79e505e5d 100644
--- a/spec/controllers/registrations_controller_spec.rb
+++ b/spec/controllers/registrations_controller_spec.rb
@@ -77,14 +77,32 @@ describe RegistrationsController do
context 'when send_user_confirmation_email is true' do
before do
stub_application_setting(send_user_confirmation_email: true)
- allow(User).to receive(:allow_unconfirmed_access_for).and_return 2.days
end
- it 'authenticates the user and sends a confirmation email' do
- post(:create, params: user_params)
+ context 'when a grace period is active for confirming the email address' do
+ before do
+ allow(User).to receive(:allow_unconfirmed_access_for).and_return 2.days
+ end
+
+ it 'sends a confirmation email and redirects to the dashboard' do
+ post(:create, params: user_params)
+
+ expect(ActionMailer::Base.deliveries.last.to.first).to eq(user_params[:user][:email])
+ expect(response).to redirect_to(dashboard_projects_path)
+ end
+ end
- expect(ActionMailer::Base.deliveries.last.to.first).to eq(user_params[:user][:email])
- expect(response).to redirect_to(dashboard_projects_path)
+ context 'when no grace period is active for confirming the email address' do
+ before do
+ allow(User).to receive(:allow_unconfirmed_access_for).and_return 0
+ end
+
+ it 'sends a confirmation email and redirects to the almost there page' do
+ post(:create, params: user_params)
+
+ expect(ActionMailer::Base.deliveries.last.to.first).to eq(user_params[:user][:email])
+ expect(response).to redirect_to(users_almost_there_path)
+ end
end
end