Commit aac8d1f3 authored by Matija Čupić's avatar Matija Čupić

Add check for nil auto_devops in Projects::UpdateService

parent 6e354cb6
......@@ -36,7 +36,7 @@ module Projects
end
def run_auto_devops_pipeline?
return false if project.repository.gitlab_ci_yml || !project.auto_devops.previous_changes.include?('enabled')
return false if project.repository.gitlab_ci_yml || project.auto_devops.nil? || !project.auto_devops.previous_changes.include?('enabled')
project.auto_devops.enabled? || (project.auto_devops.enabled.nil? && Gitlab::CurrentSettings.auto_devops_enabled?)
end
......
......@@ -275,6 +275,10 @@ describe Projects::UpdateService do
it { is_expected.to eq(false) }
end
context 'when auto devops is nil' do
it { is_expected.to eq(false) }
end
context 'when auto devops is explicitly enabled' do
before do
project.create_auto_devops!(enabled: true)
......
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