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
28aaf40d
Commit
28aaf40d
authored
Jan 04, 2019
by
Olivier Gonzalez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix title and description for issue created from vulnerability
Add fallback to other properties when necessary
parent
4aa14d46
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
22 deletions
+47
-22
ee/changelogs/unreleased/8596-fix_title_and_description_for_issue_created_from_vulnerability.yml
..._and_description_for_issue_created_from_vulnerability.yml
+5
-0
ee/lib/gitlab/vulnerabilities/standard_vulnerability.rb
ee/lib/gitlab/vulnerabilities/standard_vulnerability.rb
+5
-2
ee/spec/lib/gitlab/vulnerabilities/standard_vulnerability_spec.rb
...lib/gitlab/vulnerabilities/standard_vulnerability_spec.rb
+37
-20
No files found.
ee/changelogs/unreleased/8596-fix_title_and_description_for_issue_created_from_vulnerability.yml
0 → 100644
View file @
28aaf40d
---
title
:
Fix title and description for issue created from a vulnerability
merge_request
:
9022
author
:
type
:
fixed
ee/lib/gitlab/vulnerabilities/standard_vulnerability.rb
View file @
28aaf40d
...
...
@@ -5,7 +5,6 @@ module Gitlab
class
StandardVulnerability
<
BaseVulnerability
# Passthrough properties
%i[
title
severity
confidence
solution
...
...
@@ -17,8 +16,12 @@ module Gitlab
end
end
def
title
@data
[
:title
].
presence
||
@data
[
:name
]
end
def
description
@data
[
:description
].
presence
||
@data
[
:title
]
@data
[
:description
].
presence
||
title
end
def
file
...
...
ee/spec/lib/gitlab/vulnerabilities/standard_vulnerability_spec.rb
View file @
28aaf40d
...
...
@@ -4,6 +4,7 @@ require 'spec_helper'
describe
Gitlab
::
Vulnerabilities
::
StandardVulnerability
do
let
(
:title
)
{
'Predictable pseudorandom number generator'
}
let
(
:name
)
{
'Predictable pseudorandom number generator (from name)'
}
let
(
:description
)
{
'Description of Predictable pseudorandom number generator'
}
let
(
:severity
)
{
'Low'
}
let
(
:confidence
)
{
'High'
}
...
...
@@ -37,24 +38,6 @@ describe Gitlab::Vulnerabilities::StandardVulnerability do
expect
(
vulnerability
).
to
be_kind_of
(
Gitlab
::
Vulnerabilities
::
BaseVulnerability
)
end
describe
'#title'
do
context
'when title is present'
do
it
'returns title'
do
vulnerability
=
described_class
.
new
(
title:
title
)
expect
(
vulnerability
.
title
).
to
eq
title
end
end
context
'when title is not set'
do
it
'returns nil'
do
vulnerability
=
described_class
.
new
(
foo:
'bar'
)
expect
(
vulnerability
.
title
).
to
be_nil
end
end
end
describe
'#severity'
do
context
'when severity is present'
do
it
'returns severity'
do
...
...
@@ -145,6 +128,32 @@ describe Gitlab::Vulnerabilities::StandardVulnerability do
end
end
describe
'#title'
do
context
'when title is present'
do
it
'returns title'
do
vulnerability
=
described_class
.
new
(
title:
title
)
expect
(
vulnerability
.
title
).
to
eq
title
end
end
context
'when title is not set'
do
it
'fallbacks to name'
do
vulnerability
=
described_class
.
new
(
name:
name
)
expect
(
vulnerability
.
title
).
to
eq
name
end
end
context
'when title and name are not set'
do
it
'returns nil'
do
vulnerability
=
described_class
.
new
(
foo:
'bar'
)
expect
(
vulnerability
.
title
).
to
be_nil
end
end
end
describe
'#description'
do
context
'when description is present'
do
it
'returns description'
do
...
...
@@ -156,13 +165,21 @@ describe Gitlab::Vulnerabilities::StandardVulnerability do
context
'when description is not set'
do
it
'fallbacks to title'
do
vulnerability
=
described_class
.
new
(
title:
title
)
vulnerability
=
described_class
.
new
(
title:
title
,
name:
name
)
expect
(
vulnerability
.
description
).
to
eq
title
end
end
context
'when title and description are not set'
do
context
'when description and title are not set'
do
it
'fallbacks to name'
do
vulnerability
=
described_class
.
new
(
name:
name
)
expect
(
vulnerability
.
description
).
to
eq
name
end
end
context
'when title, name and description are not set'
do
it
'returns nil'
do
vulnerability
=
described_class
.
new
(
foo:
'bar'
)
...
...
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