diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-15 03:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-15 03:08:42 +0300 |
commit | 6a0085290e97f344d3ed69463c8a1f729a337bc4 (patch) | |
tree | 792f6edfaf71b3b331604a6561860eb988df8291 /spec/controllers/registrations | |
parent | 5c635722c66a32e170c3ba8150bc303124abb7a1 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers/registrations')
-rw-r--r-- | spec/controllers/registrations/experience_levels_controller_spec.rb | 49 |
1 files changed, 41 insertions, 8 deletions
diff --git a/spec/controllers/registrations/experience_levels_controller_spec.rb b/spec/controllers/registrations/experience_levels_controller_spec.rb index ee1acf3d93d..4be67f29107 100644 --- a/spec/controllers/registrations/experience_levels_controller_spec.rb +++ b/spec/controllers/registrations/experience_levels_controller_spec.rb @@ -85,16 +85,49 @@ RSpec.describe Registrations::ExperienceLevelsController do end end - context 'when a namespace_path is sent' do - it { is_expected.to have_gitlab_http_status(:redirect) } - it { is_expected.to redirect_to(group_path(namespace)) } - end + describe 'redirection' do + let(:project) { build(:project, namespace: namespace, creator: user, path: 'project-path') } + let(:issues_board) { build(:board, id: 123, project: project) } + + before do + stub_experiment_for_user( + onboarding_issues: true, + default_to_issues_board: default_to_issues_board_xp? + ) + allow_next_instance_of(LearnGitlab) 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) + end + end + + context 'when namespace_path param is missing' do + let(:params) { super().merge(namespace_path: nil) } + + where( + default_to_issues_board_xp?: [true, false], + learn_gitlab_available?: [true, false] + ) - context 'when no namespace_path is sent' do - let(:params) { super().merge(namespace_path: nil) } + with_them do + it { is_expected.to redirect_to('/') } + end + end - it { is_expected.to have_gitlab_http_status(:redirect) } - it { is_expected.to redirect_to(root_path) } + context 'when we have a namespace_path param' do + using RSpec::Parameterized::TableSyntax + + where(:default_to_issues_board_xp?, :learn_gitlab_available?, :path) do + true | true | '/group-path/project-path/-/boards/123' + true | false | '/group-path' + false | true | '/group-path' + false | false | '/group-path' + end + + with_them do + it { is_expected.to redirect_to(path) } + end + end end describe 'applying the chosen level' do |