Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
cfb03820
Commit
cfb03820
authored
Mar 31, 2022
by
Arturo Herrero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix 500 error when visiting a non-existing integration
Changelog: fixed
parent
aa1b72c3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletion
+5
-1
app/models/project.rb
app/models/project.rb
+1
-1
spec/models/project_spec.rb
spec/models/project_spec.rb
+4
-0
No files found.
app/models/project.rb
View file @
cfb03820
...
...
@@ -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
...
...
spec/models/project_spec.rb
View file @
cfb03820
...
...
@@ -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
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment