Commit aa90ca54 authored by Adam Cohen's avatar Adam Cohen Committed by Dylan Griffith

Fix bug on security config page

parent 3b9aa8e4
......@@ -22,7 +22,10 @@ module Projects
latest_pipeline_path: latest_pipeline_path,
auto_fix_enabled: autofix_enabled,
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,
auto_fix_user_path: '/' # TODO: real link will be updated with https://gitlab.com/gitlab-org/gitlab/-/issues/215669
}
......
......@@ -262,14 +262,25 @@ RSpec.describe Projects::Security::ConfigurationPresenter do
end
context "while retrieving information about gitlab ci file" do
it 'expects the gitlab_ci_presence to be true if the file is present' do
expect(subject[:gitlab_ci_present]).to eq(true)
end
context 'when a .gitlab-ci.yml file exists' do
before do
project.repository.create_file(
project.creator,
Gitlab::FileDetector::PATTERNS[:gitlab_ci],
'contents go here',
message: 'test',
branch_name: 'master')
end
it 'expects the gitlab_ci_presence to be false if the file is customized' do
allow(project).to receive(:ci_config_path).and_return('.other-gitlab-ci.yml')
it 'expects gitlab_ci_present to be true' do
expect(subject[:gitlab_ci_present]).to eq(true)
end
end
expect(subject[:gitlab_ci_present]).to eq(false)
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)
end
end
end
......
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