summaryrefslogtreecommitdiff
path: root/spec/requests/registrations_controller_spec.rb
blob: 8b857046a4db68bb2560edaf7ae7e51bc77dd979 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe RegistrationsController, type: :request, feature_category: :system_access do
  describe 'POST #create' do
    let_it_be(:user_attrs) { build_stubbed(:user).slice(:first_name, :last_name, :username, :email, :password) }

    subject(:create_user) { post user_registration_path, params: { user: user_attrs } }

    context 'when email confirmation is required' do
      before do
        stub_application_setting_enum('email_confirmation_setting', 'hard')
        stub_application_setting(require_admin_approval_after_user_signup: false)
      end

      it 'redirects to the `users_almost_there_path`', unless: Gitlab.ee? do
        create_user

        expect(response).to redirect_to(users_almost_there_path(email: user_attrs[:email]))
      end
    end
  end
end