diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-22 15:10:30 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-22 15:10:30 +0300 |
commit | 49203bfa3c7eb607a7561ae7da9b5c52aa49fd77 (patch) | |
tree | f33cd54ec9a45d69a3e58fe93735070d3b718913 /spec/helpers | |
parent | 3c9a2dd62025043448c9ea9a6df86422874ee4be (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/helpers')
-rw-r--r-- | spec/helpers/ci/pipelines_helper_spec.rb | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/spec/helpers/ci/pipelines_helper_spec.rb b/spec/helpers/ci/pipelines_helper_spec.rb index 1a5c036b4f1..cb72fd5b156 100644 --- a/spec/helpers/ci/pipelines_helper_spec.rb +++ b/spec/helpers/ci/pipelines_helper_spec.rb @@ -97,7 +97,8 @@ RSpec.describe Ci::PipelinesHelper, feature_category: :continuous_integration do :pipeline_editor_path, :suggested_ci_templates, :full_path, - :visibility_pipeline_id_type]) + :visibility_pipeline_id_type, + :show_jenkins_ci_prompt]) end end @@ -123,4 +124,39 @@ RSpec.describe Ci::PipelinesHelper, feature_category: :continuous_integration do end end end + + describe '#show_jenkins_ci_prompt' do + using RSpec::Parameterized::TableSyntax + + subject { helper.pipelines_list_data(project, 'list_url')[:show_jenkins_ci_prompt] } + + let_it_be(:user) { create(:user) } + let_it_be_with_reload(:project) { create(:project, :repository) } + let_it_be(:repository) { project.repository } + + before do + sign_in(user) + project.send(add_role_method, user) + + allow(repository).to receive(:gitlab_ci_yml).and_return(has_gitlab_ci?) + allow(repository).to receive(:jenkinsfile?).and_return(has_jenkinsfile?) + end + + where(:add_role_method, :has_gitlab_ci?, :has_jenkinsfile?, :result) do + # Test permissions + :add_owner | false | true | "true" + :add_maintainer | false | true | "true" + :add_developer | false | true | "true" + :add_guest | false | true | "false" + + # Test combination of presence of ci files + :add_owner | false | false | "false" + :add_owner | true | true | "false" + :add_owner | true | false | "false" + end + + with_them do + it { expect(subject).to eq(result) } + end + end end |