Commit da7bb81a authored by Igor Drozdov's avatar Igor Drozdov

Merge branch 'bug-store-report-service-fix' into 'master'

Fix error for projects without security setting

See merge request gitlab-org/gitlab!50490
parents 4ab9b3ea 0c332366
...@@ -211,7 +211,7 @@ module Security ...@@ -211,7 +211,7 @@ module Security
end end
def auto_fix_enabled? 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) project.security_setting.auto_fix_enabled_types.include?(report.type.to_sym)
end end
......
---
title: Fix StoreReportService related to autofix
merge_request: 50490
author:
type: fixed
...@@ -254,6 +254,18 @@ RSpec.describe Security::StoreReportService, '#execute' do ...@@ -254,6 +254,18 @@ RSpec.describe Security::StoreReportService, '#execute' do
subject subject
end end
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
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