Commit 0c332366 authored by Tetiana Chupryna's avatar Tetiana Chupryna Committed by Igor Drozdov

Fix error for projects without security setting

parent 281fda79
......@@ -211,7 +211,7 @@ module Security
end
def auto_fix_enabled?
return false unless project.security_setting.auto_fix_enabled?
return false unless project.security_setting&.auto_fix_enabled?
project.security_setting.auto_fix_enabled_types.include?(report.type.to_sym)
end
......
---
title: Fix StoreReportService related to autofix
merge_request: 50490
author:
type: fixed
......@@ -254,6 +254,18 @@ RSpec.describe Security::StoreReportService, '#execute' do
subject
end
end
context 'when security setting is not created' do
before do
project.security_setting.destroy!
project.reload
end
it 'does not start auto fix worker' do
expect(Security::AutoFixWorker).not_to receive(:perform_async)
expect(subject[:status]).to eq(:success)
end
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