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
52fe994d
Commit
52fe994d
authored
Oct 24, 2020
by
Jonathan Schafer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use REPORT_TYPES instead of numbers
parent
5e55c9d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
4 deletions
+19
-4
ee/spec/models/vulnerabilities/finding_spec.rb
ee/spec/models/vulnerabilities/finding_spec.rb
+19
-4
No files found.
ee/spec/models/vulnerabilities/finding_spec.rb
View file @
52fe994d
...
...
@@ -113,11 +113,13 @@ RSpec.describe Vulnerabilities::Finding do
let!
(
:vulnerability_secret_detection
)
{
create
(
:vulnerabilities_finding
,
report_type: :secret_detection
)
}
let!
(
:vulnerability_dast
)
{
create
(
:vulnerabilities_finding
,
report_type: :dast
)
}
let!
(
:vulnerability_depscan
)
{
create
(
:vulnerabilities_finding
,
report_type: :dependency_scanning
)
}
let!
(
:vulnerability_covfuzz
)
{
create
(
:vulnerabilities_finding
,
report_type: :coverage_fuzzing
)
}
let!
(
:vulnerability_apifuzz
)
{
create
(
:vulnerabilities_finding
,
report_type: :api_fuzzing
)
}
subject
{
described_class
.
by_report_types
(
param
)
}
context
'with one param'
do
let
(
:param
)
{
0
}
let
(
:param
)
{
Vulnerabilities
::
Finding
::
REPORT_TYPES
[
'sast'
]
}
it
'returns found record'
do
is_expected
.
to
contain_exactly
(
vulnerability_sast
)
...
...
@@ -125,15 +127,28 @@ RSpec.describe Vulnerabilities::Finding do
end
context
'with array of params'
do
let
(
:param
)
{
[
1
,
3
,
4
]
}
let
(
:param
)
do
[
Vulnerabilities
::
Finding
::
REPORT_TYPES
[
'dependency_scanning'
],
Vulnerabilities
::
Finding
::
REPORT_TYPES
[
'dast'
],
Vulnerabilities
::
Finding
::
REPORT_TYPES
[
'secret_detection'
],
Vulnerabilities
::
Finding
::
REPORT_TYPES
[
'coverage_fuzzing'
],
Vulnerabilities
::
Finding
::
REPORT_TYPES
[
'api_fuzzing'
]
]
end
it
'returns found records'
do
is_expected
.
to
contain_exactly
(
vulnerability_dast
,
vulnerability_depscan
,
vulnerability_secret_detection
)
is_expected
.
to
contain_exactly
(
vulnerability_dast
,
vulnerability_depscan
,
vulnerability_secret_detection
,
vulnerability_covfuzz
,
vulnerability_apifuzz
)
end
end
context
'without found record'
do
let
(
:param
)
{
2
}
let
(
:param
)
{
Vulnerabilities
::
Finding
::
REPORT_TYPES
[
'container_scanning'
]
}
it
'returns empty collection'
do
is_expected
.
to
be_empty
...
...
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