Commit bc5689fd authored by Dylan Griffith's avatar Dylan Griffith

Merge branch '336504-fix-security-config-page-bug' into 'master'

Fix bug on security config page

See merge request gitlab-org/gitlab!70025
parents f0590e1d aa90ca54
...@@ -22,7 +22,10 @@ module Projects ...@@ -22,7 +22,10 @@ module Projects
latest_pipeline_path: latest_pipeline_path, latest_pipeline_path: latest_pipeline_path,
auto_fix_enabled: autofix_enabled, auto_fix_enabled: autofix_enabled,
can_toggle_auto_fix_settings: auto_fix_permission, can_toggle_auto_fix_settings: auto_fix_permission,
gitlab_ci_present: project.uses_default_ci_config?, # TODO: gitlab_ci_present will incorrectly report `false` if the CI/CD configuration file name
# has been customized and a file with the given custom name exists in the repo. This edge case
# will be addressed in https://gitlab.com/gitlab-org/gitlab/-/issues/342465
gitlab_ci_present: project.repository.gitlab_ci_yml.present?,
gitlab_ci_history_path: gitlab_ci_history_path, gitlab_ci_history_path: gitlab_ci_history_path,
auto_fix_user_path: '/' # TODO: real link will be updated with https://gitlab.com/gitlab-org/gitlab/-/issues/215669 auto_fix_user_path: '/' # TODO: real link will be updated with https://gitlab.com/gitlab-org/gitlab/-/issues/215669
} }
......
...@@ -262,16 +262,27 @@ RSpec.describe Projects::Security::ConfigurationPresenter do ...@@ -262,16 +262,27 @@ RSpec.describe Projects::Security::ConfigurationPresenter do
end end
context "while retrieving information about gitlab ci file" do context "while retrieving information about gitlab ci file" do
it 'expects the gitlab_ci_presence to be true if the file is present' do context 'when a .gitlab-ci.yml file exists' do
expect(subject[:gitlab_ci_present]).to eq(true) before do
project.repository.create_file(
project.creator,
Gitlab::FileDetector::PATTERNS[:gitlab_ci],
'contents go here',
message: 'test',
branch_name: 'master')
end end
it 'expects the gitlab_ci_presence to be false if the file is customized' do it 'expects gitlab_ci_present to be true' do
allow(project).to receive(:ci_config_path).and_return('.other-gitlab-ci.yml') expect(subject[:gitlab_ci_present]).to eq(true)
end
end
context 'when a .gitlab-ci.yml file does not exist' do
it 'expects gitlab_ci_present to be false if the file is not present' do
expect(subject[:gitlab_ci_present]).to eq(false) expect(subject[:gitlab_ci_present]).to eq(false)
end end
end end
end
it 'includes the auto_devops_path' do it 'includes the auto_devops_path' do
expect(subject[:auto_devops_path]).to eq(project_settings_ci_cd_path(project, anchor: 'autodevops-settings')) expect(subject[:auto_devops_path]).to eq(project_settings_ci_cd_path(project, anchor: 'autodevops-settings'))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment