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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
1beb7ffc
Commit
1beb7ffc
authored
Dec 05, 2018
by
Ash McKenzie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing spec coverage for LfsToken
Added specs for #deploy_key_pushable?() and #type()
parent
22954f22
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
0 deletions
+55
-0
spec/lib/gitlab/lfs_token_spec.rb
spec/lib/gitlab/lfs_token_spec.rb
+55
-0
No files found.
spec/lib/gitlab/lfs_token_spec.rb
View file @
1beb7ffc
...
@@ -185,4 +185,59 @@ describe Gitlab::LfsToken, :clean_gitlab_redis_shared_state do
...
@@ -185,4 +185,59 @@ describe Gitlab::LfsToken, :clean_gitlab_redis_shared_state do
end
end
end
end
end
end
describe
'#deploy_key_pushable?'
do
let
(
:lfs_token
)
{
described_class
.
new
(
actor
)
}
context
'when actor is not a DeployKey'
do
let
(
:actor
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
it
'returns false'
do
expect
(
lfs_token
.
deploy_key_pushable?
(
project
)).
to
be_falsey
end
end
context
'when actor is a DeployKey'
do
let
(
:deploy_keys_project
)
{
create
(
:deploy_keys_project
,
can_push:
can_push
)
}
let
(
:project
)
{
deploy_keys_project
.
project
}
let
(
:actor
)
{
deploy_keys_project
.
deploy_key
}
context
'but the DeployKey cannot push to the project'
do
let
(
:can_push
)
{
false
}
it
'returns false'
do
expect
(
lfs_token
.
deploy_key_pushable?
(
project
)).
to
be_falsey
end
end
context
'and the DeployKey can push to the project'
do
let
(
:can_push
)
{
true
}
it
'returns true'
do
expect
(
lfs_token
.
deploy_key_pushable?
(
project
)).
to
be_truthy
end
end
end
end
describe
'#type'
do
let
(
:lfs_token
)
{
described_class
.
new
(
actor
)
}
context
'when actor is not a User'
do
let
(
:actor
)
{
create
(
:deploy_key
)
}
it
'returns false'
do
expect
(
lfs_token
.
type
).
to
eq
(
:lfs_deploy_token
)
end
end
context
'when actor is a User'
do
let
(
:actor
)
{
create
(
:user
)
}
it
'returns false'
do
expect
(
lfs_token
.
type
).
to
eq
(
:lfs_token
)
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