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
Boxiang Sun
gitlab-ce
Commits
a387ff7b
Commit
a387ff7b
authored
Sep 16, 2016
by
Kamil Trzcinski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix specs after renaming authentication_capabilities
parent
e941365f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
14 deletions
+16
-14
app/helpers/lfs_helper.rb
app/helpers/lfs_helper.rb
+3
-3
spec/lib/gitlab/auth_spec.rb
spec/lib/gitlab/auth_spec.rb
+12
-10
spec/lib/gitlab/git_access_wiki_spec.rb
spec/lib/gitlab/git_access_wiki_spec.rb
+1
-1
No files found.
app/helpers/lfs_helper.rb
View file @
a387ff7b
...
...
@@ -29,17 +29,17 @@ module LfsHelper
end
def
user_can_download_code?
has_
capability?
(
:download_code
)
&&
user
&&
user
.
can?
(
:download_code
,
project
)
has_
authentication_ability?
(
:download_code
)
&&
can?
(
user
,
:download_code
,
project
)
end
def
build_can_download_code?
has_
capability?
(
:build_download_code
)
&&
user
&&
user
.
can?
(
:build_download_code
,
project
)
has_
authentication_ability?
(
:build_download_code
)
&&
can?
(
user
,
:build_download_code
,
project
)
end
def
lfs_upload_access?
return
false
unless
project
.
lfs_enabled?
has_
capability?
(
:push_code
)
&&
user
&&
user
.
can?
(
:push_code
,
project
)
has_
authentication_ability?
(
:push_code
)
&&
can?
(
user
,
:push_code
,
project
)
end
def
render_lfs_forbidden
...
...
spec/lib/gitlab/auth_spec.rb
View file @
a387ff7b
...
...
@@ -26,16 +26,18 @@ describe Gitlab::Auth, lib: true do
end
end
context
'for non-running build'
do
let!
(
:build
)
{
create
(
:ci_build
,
:pending
)
}
let
(
:project
)
{
build
.
project
}
before
do
expect
(
gl_auth
).
to
receive
(
:rate_limit!
).
with
(
'ip'
,
success:
false
,
login:
'gitlab-ci-token'
)
end
it
'denies authentication'
do
expect
(
subject
).
to
eq
(
Gitlab
::
Auth
::
Result
.
new
)
(
HasStatus
::
AVAILABLE_STATUSES
-
[
:running
]).
each
do
|
build_status
|
context
"for
#{
build_status
}
build"
do
let!
(
:build
)
{
create
(
:ci_build
,
status:
build_status
)
}
let
(
:project
)
{
build
.
project
}
before
do
expect
(
gl_auth
).
to
receive
(
:rate_limit!
).
with
(
'ip'
,
success:
false
,
login:
'gitlab-ci-token'
)
end
it
'denies authentication'
do
expect
(
subject
).
not_to
eq
(
Gitlab
::
Auth
::
Result
.
new
)
end
end
end
end
...
...
spec/lib/gitlab/git_access_wiki_spec.rb
View file @
a387ff7b
require
'spec_helper'
describe
Gitlab
::
GitAccessWiki
,
lib:
true
do
let
(
:access
)
{
Gitlab
::
GitAccessWiki
.
new
(
user
,
project
,
'web'
,
authentication_abilities
)
}
let
(
:access
)
{
Gitlab
::
GitAccessWiki
.
new
(
user
,
project
,
'web'
,
authentication_abilities
:
authentication_abilities
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:authentication_abilities
)
do
...
...
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