diff options
Diffstat (limited to 'spec/controllers/registrations')
-rw-r--r-- | spec/controllers/registrations/experience_levels_controller_spec.rb | 4 | ||||
-rw-r--r-- | spec/controllers/registrations/welcome_controller_spec.rb | 24 |
2 files changed, 26 insertions, 2 deletions
diff --git a/spec/controllers/registrations/experience_levels_controller_spec.rb b/spec/controllers/registrations/experience_levels_controller_spec.rb index 79fa3f1474a..6b8ab3ec715 100644 --- a/spec/controllers/registrations/experience_levels_controller_spec.rb +++ b/spec/controllers/registrations/experience_levels_controller_spec.rb @@ -76,7 +76,7 @@ RSpec.describe Registrations::ExperienceLevelsController do let(:learn_gitlab_available?) { true } before do - allow_next_instance_of(LearnGitlab) do |learn_gitlab| + allow_next_instance_of(LearnGitlab::Project) do |learn_gitlab| allow(learn_gitlab).to receive(:available?).and_return(learn_gitlab_available?) allow(learn_gitlab).to receive(:project).and_return(project) allow(learn_gitlab).to receive(:board).and_return(issues_board) @@ -136,7 +136,7 @@ RSpec.describe Registrations::ExperienceLevelsController do let(:params) { super().merge(experience_level: :novice) } before do - allow_next(LearnGitlab).to receive(:available?).and_return(false) + allow_next(LearnGitlab::Project).to receive(:available?).and_return(false) end it 'does not add a BoardLabel' do diff --git a/spec/controllers/registrations/welcome_controller_spec.rb b/spec/controllers/registrations/welcome_controller_spec.rb index 008259a8bfa..6d34b56df09 100644 --- a/spec/controllers/registrations/welcome_controller_spec.rb +++ b/spec/controllers/registrations/welcome_controller_spec.rb @@ -77,6 +77,30 @@ RSpec.describe Registrations::WelcomeController do it { is_expected.to redirect_to(dashboard_projects_path)} + context 'when the new user already has any accepted group membership' do + let!(:member1) { create(:group_member, user: user) } + + it 'redirects to the group activity page' do + expect(subject).to redirect_to(activity_group_path(member1.source)) + end + + context 'when the new user already has more than 1 accepted group membership' do + it 'redirects to the most recent membership group activty page' do + member2 = create(:group_member, user: user) + + expect(subject).to redirect_to(activity_group_path(member2.source)) + end + end + + context 'when the member has an orphaned source at the time of the welcome' do + it 'redirects to the project dashboard page' do + member1.source.delete + + expect(subject).to redirect_to(dashboard_projects_path) + end + end + end + context 'when the user opted in' do let(:email_opted_in) { '1' } |