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:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-04-14 21:08:29 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-04-14 21:08:29 +0300
commitf55c9253556dd5dab700d76fa88aa04891343100 (patch)
treeb8a6bcc093304acd38c53f7fa2a6be35708c1003 /spec/helpers/ci/pipelines_helper_spec.rb
parent9b762f50fee09b50b97b5ab208a9a62522447c8c (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers/ci/pipelines_helper_spec.rb')
-rw-r--r--spec/helpers/ci/pipelines_helper_spec.rb41
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/helpers/ci/pipelines_helper_spec.rb b/spec/helpers/ci/pipelines_helper_spec.rb
index 2b76eaa87bc..c473e1e4ab6 100644
--- a/spec/helpers/ci/pipelines_helper_spec.rb
+++ b/spec/helpers/ci/pipelines_helper_spec.rb
@@ -151,5 +151,46 @@ RSpec.describe Ci::PipelinesHelper do
end
end
end
+
+ describe 'the `registration_token` attribute' do
+ subject { data[:registration_token] }
+
+ describe 'when the project is eligible for the `ios_specific_templates` experiment' do
+ let_it_be(:project) { create(:project, :auto_devops_disabled) }
+ let_it_be(:user) { create(:user) }
+
+ before do
+ allow(helper).to receive(:current_user).and_return(user)
+ project.add_developer(user)
+ create(:project_setting, project: project, target_platforms: %w(ios))
+ end
+
+ context 'when the `ios_specific_templates` experiment variant is control' do
+ before do
+ stub_experiments(ios_specific_templates: :control)
+ end
+
+ it { is_expected.to be_nil }
+ end
+
+ context 'when the `ios_specific_templates` experiment variant is candidate' do
+ before do
+ stub_experiments(ios_specific_templates: :candidate)
+ end
+
+ context 'when the user cannot register project runners' do
+ before do
+ allow(helper).to receive(:can?).with(user, :register_project_runners, project).and_return(false)
+ end
+
+ it { is_expected.to be_nil }
+ end
+
+ context 'when the user can register project runners' do
+ it { is_expected.to eq(project.runners_token) }
+ end
+ end
+ end
+ end
end
end