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
3b1dbd53
Commit
3b1dbd53
authored
Oct 10, 2019
by
Victor Zagorodny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve scope handling in finder class
parent
9c65354b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
3 deletions
+32
-3
ee/app/finders/security/vulnerability_findings_finder.rb
ee/app/finders/security/vulnerability_findings_finder.rb
+6
-3
ee/spec/finders/security/vulnerability_findings_finder_spec.rb
...ec/finders/security/vulnerability_findings_finder_spec.rb
+26
-0
No files found.
ee/app/finders/security/vulnerability_findings_finder.rb
View file @
3b1dbd53
...
...
@@ -64,12 +64,15 @@ module Security
end
def
init_collection
(
scope
)
if
scope
==
:all
case
scope
when
:all
vulnerable
.
all_vulnerabilities
elsif
scope
==
:with_sha
when
:with_sha
vulnerable
.
latest_vulnerabilities_with_sha
else
when
:latest
vulnerable
.
latest_vulnerabilities
else
raise
ArgumentError
,
"invalid value for 'scope':
#{
scope
}
"
end
end
end
...
...
ee/spec/finders/security/vulnerability_findings_finder_spec.rb
View file @
3b1dbd53
...
...
@@ -130,5 +130,31 @@ describe Security::VulnerabilityFindingsFinder do
end
end
end
describe
'scope specifiers'
do
using
RSpec
::
Parameterized
::
TableSyntax
where
(
:scope
)
do
[
[
:all
],
[
:with_sha
],
[
:latest
]
]
end
with_them
do
it
'accepts the scope specifier as valid'
do
expect
{
described_class
.
new
(
group
).
execute
(
scope
)
}.
not_to
raise_error
end
end
context
'with an invalid scope specifier'
do
it
'raises error'
do
expect
{
described_class
.
new
(
group
).
execute
(
:invalid
)
}.
to
(
raise_error
(
ArgumentError
,
"invalid value for 'scope': invalid"
)
)
end
end
end
end
end
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