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
edf4b5dd
Commit
edf4b5dd
authored
Apr 24, 2020
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix a flaky spec that would assume records order
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
be07e235
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
13 deletions
+17
-13
ee/spec/factories/projects.rb
ee/spec/factories/projects.rb
+6
-0
ee/spec/lib/ee/api/entities/vulnerability_spec.rb
ee/spec/lib/ee/api/entities/vulnerability_spec.rb
+5
-7
ee/spec/models/vulnerability_spec.rb
ee/spec/models/vulnerability_spec.rb
+4
-4
ee/spec/requests/api/vulnerability_exports_spec.rb
ee/spec/requests/api/vulnerability_exports_spec.rb
+1
-1
ee/spec/workers/vulnerability_exports/export_worker_spec.rb
ee/spec/workers/vulnerability_exports/export_worker_spec.rb
+1
-1
No files found.
ee/spec/factories/projects.rb
View file @
edf4b5dd
...
...
@@ -86,6 +86,12 @@ FactoryBot.modify do
import_type
{
'github'
}
end
trait
:with_vulnerability
do
after
(
:create
)
do
|
project
|
create
(
:vulnerability
,
:detected
,
project:
project
)
end
end
trait
:with_vulnerabilities
do
after
(
:create
)
do
|
project
|
create_list
(
:vulnerability
,
2
,
:detected
,
project:
project
)
...
...
ee/spec/lib/ee/api/entities/vulnerability_spec.rb
View file @
edf4b5dd
...
...
@@ -3,16 +3,14 @@
require
'spec_helper'
describe
::
EE
::
API
::
Entities
::
Vulnerability
do
before
do
create_list
(
:vulnerabilities_finding
,
2
,
vulnerability:
vulnerability
)
end
let_it_be
(
:project
)
{
create
(
:project
,
:with_vulnerabilities
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:with_vulnerability
)
}
let
(
:vulnerability
)
{
project
.
vulnerabilities
.
first
}
let
(
:entity
)
{
described_class
.
new
(
vulnerability
)
}
subject
{
described_class
.
new
(
vulnerability
).
as_json
}
subject
{
entity
.
as_json
}
before
do
create
(
:vulnerabilities_finding
,
vulnerability:
vulnerability
)
end
it
'contains vulnerability properties'
do
expect
(
subject
[
:id
]).
to
eq
(
vulnerability
.
id
)
...
...
ee/spec/models/vulnerability_spec.rb
View file @
edf4b5dd
...
...
@@ -168,7 +168,7 @@ describe Vulnerability do
end
describe
'#finding'
do
let_it_be
(
:project
)
{
create
(
:project
,
:with_vulnerabilit
ies
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:with_vulnerabilit
y
)
}
let_it_be
(
:vulnerability
)
{
project
.
vulnerabilities
.
first
}
let_it_be
(
:finding1
)
{
create
(
:vulnerabilities_occurrence
,
vulnerability:
vulnerability
)
}
let_it_be
(
:finding2
)
{
create
(
:vulnerabilities_occurrence
,
vulnerability:
vulnerability
)
}
...
...
@@ -181,7 +181,7 @@ describe Vulnerability do
end
describe
'#finding_scanner_name'
do
let_it_be
(
:project
)
{
create
(
:project
,
:with_vulnerabilit
ies
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:with_vulnerabilit
y
)
}
let_it_be
(
:vulnerability
)
{
project
.
vulnerabilities
.
first
}
let_it_be
(
:finding
)
{
create
(
:vulnerabilities_occurrence
,
vulnerability:
vulnerability
)
}
...
...
@@ -191,7 +191,7 @@ describe Vulnerability do
end
describe
'#project_default_branch'
do
let_it_be
(
:project
)
{
create
(
:project
,
:repository
,
:with_vulnerabilit
ies
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:repository
,
:with_vulnerabilit
y
)
}
let_it_be
(
:vulnerability
)
{
project
.
vulnerabilities
.
first
}
subject
{
vulnerability
.
project_default_branch
}
...
...
@@ -200,7 +200,7 @@ describe Vulnerability do
end
describe
'#resolved_on_default_branch'
do
let_it_be
(
:project
)
{
create
(
:project
,
:repository
,
:with_vulnerabilit
ies
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:repository
,
:with_vulnerabilit
y
)
}
let_it_be
(
:pipeline_with_vulnerability
)
{
create
(
:ci_pipeline
,
:success
,
project:
project
,
sha:
project
.
commit
.
id
)
}
let_it_be
(
:vulnerability
)
{
project
.
vulnerabilities
.
first
}
let_it_be
(
:finding1
)
{
create
(
:vulnerabilities_occurrence
,
vulnerability:
vulnerability
,
pipelines:
[
pipeline_with_vulnerability
])
}
...
...
ee/spec/requests/api/vulnerability_exports_spec.rb
View file @
edf4b5dd
...
...
@@ -10,7 +10,7 @@ describe API::VulnerabilityExports do
end
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:with_vulnerabilit
ies
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:with_vulnerabilit
y
)
}
let
(
:project_vulnerability_exports_path
)
{
"/projects/
#{
project
.
id
}
/vulnerability_exports"
}
let
(
:project_vulnerability_export_path
)
{
"
#{
project_vulnerability_exports_path
}
/
#{
vulnerability_export
.
id
}
"
}
...
...
ee/spec/workers/vulnerability_exports/export_worker_spec.rb
View file @
edf4b5dd
...
...
@@ -4,7 +4,7 @@ require 'spec_helper'
RSpec
.
describe
VulnerabilityExports
::
ExportWorker
,
type: :worker
do
describe
'#perform'
do
let_it_be
(
:project
)
{
create
(
:project
,
:with_vulnerabilit
ies
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:with_vulnerabilit
y
)
}
let!
(
:vulnerability_export
)
{
create
(
:vulnerability_export
,
:created
,
:csv
,
project:
project
)
}
let
(
:worker
)
{
described_class
.
new
}
...
...
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