diff options
Diffstat (limited to 'spec/controllers/registrations_controller_spec.rb')
-rw-r--r-- | spec/controllers/registrations_controller_spec.rb | 59 |
1 files changed, 29 insertions, 30 deletions
diff --git a/spec/controllers/registrations_controller_spec.rb b/spec/controllers/registrations_controller_spec.rb index 2c766035d87..f80e18df22e 100644 --- a/spec/controllers/registrations_controller_spec.rb +++ b/spec/controllers/registrations_controller_spec.rb @@ -128,7 +128,7 @@ RSpec.describe RegistrationsController 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) + expect(response).to redirect_to(users_sign_up_welcome_path) end end end @@ -164,10 +164,10 @@ RSpec.describe RegistrationsController do expect(flash[:alert]).to eq(_('There was an error with the reCAPTCHA. Please solve the reCAPTCHA again.')) end - it 'redirects to the dashboard when the reCAPTCHA is solved' do + it 'redirects to the welcome page when the reCAPTCHA is solved' do post(:create, params: user_params) - expect(flash[:notice]).to eq(I18n.t('devise.registrations.signed_up')) + expect(response).to redirect_to(users_sign_up_welcome_path) end end @@ -316,6 +316,12 @@ RSpec.describe RegistrationsController do stub_experiment(signup_flow: true, terms_opt_in: true) end + it 'records user for the terms_opt_in experiment' do + expect(controller).to receive(:record_experiment_user).with(:terms_opt_in) + + subject + end + context 'when user is not part of the experiment' do before do stub_experiment_for_user(signup_flow: true, terms_opt_in: false) @@ -458,42 +464,35 @@ RSpec.describe RegistrationsController do describe '#welcome' do subject { get :welcome } - context 'signup_flow experiment enabled' do - before do - stub_experiment_for_user(signup_flow: true) - end + it 'renders the devise_experimental_separate_sign_up_flow layout' do + sign_in(create(:user)) - it 'renders the devise_experimental_separate_sign_up_flow layout' do - sign_in(create(:user)) + expected_layout = Gitlab.ee? ? :checkout : :devise_experimental_separate_sign_up_flow - expected_layout = Gitlab.ee? ? :checkout : :devise_experimental_separate_sign_up_flow + expect(subject).to render_template(expected_layout) + end - expect(subject).to render_template(expected_layout) + context '2FA is required from group' do + before do + user = create(:user, require_two_factor_authentication_from_group: true) + sign_in(user) end - context '2FA is required from group' do - before do - user = create(:user, require_two_factor_authentication_from_group: true) - sign_in(user) - end - - it 'does not perform a redirect' do - expect(subject).not_to redirect_to(profile_two_factor_auth_path) - end + it 'does not perform a redirect' do + expect(subject).not_to redirect_to(profile_two_factor_auth_path) end end + end - context 'signup_flow experiment disabled' do - before do - sign_in(create(:user)) - stub_experiment_for_user(signup_flow: false) - end - - it 'renders the devise layout' do - expected_layout = Gitlab.ee? ? :checkout : :devise + describe '#update_registration' do + subject(:update_registration) do + patch :update_registration, params: { user: { role: 'software_developer', setup_for_company: 'false' } } + end - expect(subject).to render_template(expected_layout) - end + before do + sign_in(create(:user)) end + + it { is_expected.to redirect_to(dashboard_projects_path)} end end |