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
72d0a0ad
Commit
72d0a0ad
authored
Dec 04, 2019
by
Etienne Baqué
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated release files based on code review
Updated release controller spec file. Added new API entity spec file.
parent
42abe89c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
1 deletion
+43
-1
spec/controllers/projects/releases_controller_spec.rb
spec/controllers/projects/releases_controller_spec.rb
+3
-1
spec/lib/api/entities/release_spec.rb
spec/lib/api/entities/release_spec.rb
+40
-0
No files found.
spec/controllers/projects/releases_controller_spec.rb
View file @
72d0a0ad
...
...
@@ -192,9 +192,11 @@ describe Projects::ReleasesController do
end
context
'when the release was created before evidence existed'
do
it
'returns an empty json'
do
before
do
release
.
evidence
.
destroy
end
it
'returns an empty json'
do
subject
expect
(
json_response
).
to
eq
({})
...
...
spec/lib/api/entities/release_spec.rb
0 → 100644
View file @
72d0a0ad
# frozen_string_literal: true
require
'spec_helper'
describe
API
::
Entities
::
Release
do
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:release
)
{
create
(
:release
,
:with_evidence
,
project:
project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:entity
)
{
described_class
.
new
(
release
,
current_user:
user
)
}
subject
{
entity
.
as_json
}
describe
'evidence'
do
context
'when the current user can download code'
do
it
'exposes the evidence sha and the json path'
do
allow
(
Ability
).
to
receive
(
:allowed?
).
and_call_original
allow
(
Ability
).
to
receive
(
:allowed?
)
.
with
(
user
,
:download_code
,
project
).
and_return
(
true
)
expect
(
subject
[
:evidence_sha
]).
to
eq
(
release
.
evidence_sha
)
expect
(
subject
[
:assets
][
:evidence_file_path
]).
to
eq
(
Gitlab
::
Routing
.
url_helpers
.
evidence_project_release_url
(
project
,
release
.
tag
,
format: :json
)
)
end
end
context
'when the current user cannot download code'
do
it
'does not expose any evidence data'
do
allow
(
Ability
).
to
receive
(
:allowed?
).
and_call_original
allow
(
Ability
).
to
receive
(
:allowed?
)
.
with
(
user
,
:download_code
,
project
).
and_return
(
false
)
expect
(
subject
.
keys
).
not_to
include
(
:evidence_sha
)
expect
(
subject
[
:assets
].
keys
).
not_to
include
(
:evidence_file_path
)
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