Commit cfb03820 authored by Arturo Herrero's avatar Arturo Herrero

Fix 500 error when visiting a non-existing integration

Changelog: fixed
parent aa1b72c3
......@@ -1484,7 +1484,7 @@ class Project < ApplicationRecord
end
def find_or_initialize_integration(name)
return if disabled_integrations.include?(name)
return if disabled_integrations.include?(name) || Integration.available_integration_names.exclude?(name)
find_integration(integrations, name) || build_from_instance(name) || build_integration(name)
end
......
......@@ -6288,6 +6288,10 @@ RSpec.describe Project, factory_default: :keep do
expect(subject.find_or_initialize_integration('prometheus')).to be_nil
end
it 'returns nil if integration does not exist' do
expect(subject.find_or_initialize_integration('non-existing')).to be_nil
end
context 'with an existing integration' do
subject { create(:project) }
......
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