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:
Diffstat (limited to 'spec/controllers/registrations/experience_levels_controller_spec.rb')
-rw-r--r--spec/controllers/registrations/experience_levels_controller_spec.rb49
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