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
e13ac1be
Commit
e13ac1be
authored
Aug 25, 2020
by
Mehmet Emin INAC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend the test cases with more scenarios
parent
d6e2cf27
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
9 deletions
+40
-9
ee/spec/models/merge_request_spec.rb
ee/spec/models/merge_request_spec.rb
+40
-9
No files found.
ee/spec/models/merge_request_spec.rb
View file @
e13ac1be
...
...
@@ -916,8 +916,9 @@ RSpec.describe MergeRequest do
end
context
'when there is a head pipeline'
do
let_it_be
(
:head_pipeline
)
{
create
(
:ee_ci_pipeline
,
project:
project
,
sha:
merge_request
.
diff_head_sha
)
}
before
do
create
(
:ee_ci_pipeline
,
project:
project
,
sha:
merge_request
.
diff_head_sha
)
merge_request
.
update_head_pipeline
end
...
...
@@ -933,20 +934,50 @@ RSpec.describe MergeRequest do
sha:
merge_request
.
diff_base_sha
)
end
context
'when there are missing security scans for the head pipeline'
do
let
(
:missing_scan_type
)
{
'sast'
}
let_it_be
(
:base_pipeline_build
)
{
create
(
:ci_build
,
:success
,
pipeline:
base_pipeline
,
project:
project
)
}
let_it_be
(
:head_pipeline_build
)
{
create
(
:ci_build
,
:success
,
pipeline:
head_pipeline
,
project:
project
)
}
context
'when the head pipeline does not have security scans'
do
context
'when the base pipeline does not have security scans'
do
it
{
is_expected
.
to
be_empty
}
end
context
'when the base pipeline has security scans'
do
before
do
build
=
create
(
:ci_build
,
:success
,
pipeline:
base_pipeline
,
project:
project
)
create
(
:security_scan
,
build:
build
,
scan_type:
missing_scan_type
)
create
(
:security_scan
,
build:
base_pipeline_build
,
scan_type:
'sast'
)
end
it
{
is_expected
.
to
eq
([
'sast'
])
}
end
end
context
'when the head pipeline has security scans'
do
before
do
create
(
:security_scan
,
build:
head_pipeline_build
,
scan_type:
'dast'
)
end
it
{
is_expected
.
to
eq
([
missing_scan_type
])
}
context
'when the base pipeline does not have security scans'
do
it
{
is_expected
.
to
be_empty
}
end
context
'when the base pipeline has security scans'
do
before
do
create
(
:security_scan
,
build:
base_pipeline_build
,
scan_type:
'dast'
)
end
context
'when there is no missing security scan
for the head pipeline'
do
context
'when there are no missing security scans
for the head pipeline'
do
it
{
is_expected
.
to
be_empty
}
end
context
'when there are missing security scans for the head pipeline'
do
before
do
create
(
:security_scan
,
build:
base_pipeline_build
,
scan_type:
'sast'
)
end
it
{
is_expected
.
to
eq
([
'sast'
])
}
end
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