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
7f818790
Commit
7f818790
authored
Jan 30, 2018
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tests after merge request widget changes
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
9b9b6b4d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
10 deletions
+22
-10
ee/app/serializers/ee/merge_request_widget_entity.rb
ee/app/serializers/ee/merge_request_widget_entity.rb
+2
-2
spec/ee/spec/models/ee/merge_request_spec.rb
spec/ee/spec/models/ee/merge_request_spec.rb
+13
-3
spec/ee/spec/serializers/merge_request_widget_entity_spec.rb
spec/ee/spec/serializers/merge_request_widget_entity_spec.rb
+2
-2
spec/fixtures/api/schemas/entities/merge_request_widget.json
spec/fixtures/api/schemas/entities/merge_request_widget.json
+5
-3
No files found.
ee/app/serializers/ee/merge_request_widget_entity.rb
View file @
7f818790
...
...
@@ -4,11 +4,11 @@ module EE
prepended
do
expose
:blob_path
do
expose
:head
,
if:
->
(
mr
,
_
)
{
mr
.
head_pipeline_sha
}
do
|
merge_request
|
expose
:head
_path
,
if:
->
(
mr
,
_
)
{
mr
.
head_pipeline_sha
}
do
|
merge_request
|
project_blob_path
(
merge_request
.
project
,
merge_request
.
head_pipeline_sha
)
end
expose
:base
,
if:
->
(
mr
,
_
)
{
mr
.
base_pipeline_sha
}
do
|
merge_request
|
expose
:base
_path
,
if:
->
(
mr
,
_
)
{
mr
.
base_pipeline_sha
}
do
|
merge_request
|
project_blob_path
(
merge_request
.
project
,
merge_request
.
base_pipeline_sha
)
end
end
...
...
spec/ee/spec/models/ee/merge_request_spec.rb
View file @
7f818790
...
...
@@ -174,23 +174,33 @@ describe MergeRequest do
end
describe
'#head_sast_artifact'
do
it
{
is_expected
.
to
delegate_method
(
:
head_sast_artifact
).
to
(
:head_pipeline
)
}
it
{
is_expected
.
to
delegate_method
(
:
sast_artifact
).
to
(
:head_pipeline
).
with_prefix
(
:head
)
}
end
describe
'#base_sast_artifact'
do
it
{
is_expected
.
to
delegate_method
(
:
base_sast_artifact
).
to
(
:base_pipelin
e
)
}
it
{
is_expected
.
to
delegate_method
(
:
sast_artifact
).
to
(
:base_pipeline
).
with_prefix
(
:bas
e
)
}
end
describe
'#has_sast_data?'
do
let
(
:artifact
)
{
double
(
success?:
true
)
}
before
do
allow
(
merge_request
).
to
receive
(
:sast_artifact
).
and_return
(
artifact
)
allow
(
merge_request
).
to
receive
(
:
head_
sast_artifact
).
and_return
(
artifact
)
end
it
{
expect
(
merge_request
.
has_sast_data?
).
to
be_truthy
}
end
describe
'#has_base_sast_data?'
do
let
(
:artifact
)
{
double
(
success?:
true
)
}
before
do
allow
(
merge_request
).
to
receive
(
:base_sast_artifact
).
and_return
(
artifact
)
end
it
{
expect
(
merge_request
.
has_base_sast_data?
).
to
be_truthy
}
end
describe
'#sast_container_artifact'
do
it
{
is_expected
.
to
delegate_method
(
:sast_container_artifact
).
to
(
:head_pipeline
)
}
end
...
...
spec/ee/spec/serializers/merge_request_widget_entity_spec.rb
View file @
7f818790
...
...
@@ -16,8 +16,8 @@ describe MergeRequestWidgetEntity do
allow
(
merge_request
).
to
receive
(
:head_pipeline
).
and_return
(
pipeline
)
expect
(
subject
.
as_json
).
to
include
(
:blob_path
)
expect
(
subject
.
as_json
[
:blob_path
]).
to
include
(
:base
)
expect
(
subject
.
as_json
[
:blob_path
]).
to
include
(
:head
)
expect
(
subject
.
as_json
[
:blob_path
]).
to
include
(
:base
_path
)
expect
(
subject
.
as_json
[
:blob_path
]).
to
include
(
:head
_path
)
end
it
'has performance data'
do
...
...
spec/fixtures/api/schemas/entities/merge_request_widget.json
View file @
7f818790
...
...
@@ -116,9 +116,11 @@
"approvals_path"
:
{
"type"
:
[
"string"
,
"null"
]
},
"codeclimate"
:
{
"head_path"
:
{
"type"
:
"string"
},
"head_blob_path"
:
{
"type"
:
"string"
},
"base_path"
:
{
"type"
:
"string"
},
"base_blob_path"
:
{
"type"
:
"string"
}
"base_path"
:
{
"type"
:
"string"
}
},
"blob_path"
:
{
"head_path"
:
{
"type"
:
"string"
},
"base_path"
:
{
"type"
:
"string"
}
}
},
"additionalProperties"
:
false
...
...
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