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
f684346b
Commit
f684346b
authored
Jan 24, 2018
by
Rubén Dávila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some broken specs
parent
4b898dbc
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
24 deletions
+25
-24
app/controllers/projects/lfs_locks_api_controller.rb
app/controllers/projects/lfs_locks_api_controller.rb
+7
-9
app/services/lfs/unlock_file_service.rb
app/services/lfs/unlock_file_service.rb
+1
-1
ee/lib/ee/gitlab/checks/change_access.rb
ee/lib/ee/gitlab/checks/change_access.rb
+4
-4
spec/lib/gitlab/checks/change_access_spec.rb
spec/lib/gitlab/checks/change_access_spec.rb
+0
-1
spec/services/lfs/locks_finder_service_spec.rb
spec/services/lfs/locks_finder_service_spec.rb
+1
-1
spec/services/lfs/unlock_file_service_spec.rb
spec/services/lfs/unlock_file_service_spec.rb
+12
-8
No files found.
app/controllers/projects/lfs_locks_api_controller.rb
View file @
f684346b
...
...
@@ -36,15 +36,13 @@ class Projects::LfsLocksApiController < Projects::GitHttpClientController
end
def
build_payload
(
data
,
process
)
serialized_data
=
process
?
LfsFileLockSerializer
.
new
.
represent
(
data
)
:
data
data
=
LfsFileLockSerializer
.
new
.
represent
(
data
)
if
process
if
@result
[
:status
]
==
:success
serialized_data
else
# When the locking failed due to an existent Lock the existent record
return
data
if
@result
[
:status
]
==
:success
# When the locking failed due to an existent Lock, the existent record
# is returned in `@result[:lock]`
error_payload
(
@result
[
:message
],
@result
[
:lock
]
?
serialized_data
:
{})
end
error_payload
(
@result
[
:message
],
@result
[
:lock
]
?
data
:
{})
end
def
error_payload
(
message
,
custom_attrs
=
{})
...
...
app/services/lfs/unlock_file_service.rb
View file @
f684346b
...
...
@@ -22,7 +22,7 @@ module Lfs
elsif
forced
error
(
'You must have master access to force delete a lock'
,
403
)
else
error
(
"
#{
@lock
.
path
}
is locked by GitLab User
#{
current_user
.
id
}
"
,
403
)
error
(
"
#{
@lock
.
path
}
is locked by GitLab User
#{
@lock
.
user_
id
}
"
,
403
)
end
end
end
...
...
ee/lib/ee/gitlab/checks/change_access.rb
View file @
f684346b
...
...
@@ -13,8 +13,6 @@ module EE
push_rule_committer_not_allowed:
"You cannot push commits for '%{committer_email}'. You can only push commits that were committed with one of your own verified emails."
}.
freeze
attr_reader
:push_rule
override
:exec
def
exec
return
true
if
skip_authorization
...
...
@@ -31,11 +29,13 @@ module EE
private
def
push_rule
project
.
push_rule
end
def
push_rule_check
return
unless
newrev
&&
oldrev
&&
project
.
feature_available?
(
:push_rules
)
@push_rule
=
project
.
push_rule
if
tag_name
push_rule_tag_check
else
...
...
spec/lib/gitlab/checks/change_access_spec.rb
View file @
f684346b
...
...
@@ -225,7 +225,6 @@ describe Gitlab::Checks::ChangeAccess do
subject
.
exec
end
end
context
'with LFS enabled'
do
...
...
spec/services/lfs/locks_finder_service_spec.rb
View file @
f684346b
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Lfs
::
LocksFinderService
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:params
)
{
Hash
.
new
}
let
(
:params
)
{
{}
}
subject
{
described_class
.
new
(
project
,
user
,
params
)
}
...
...
spec/services/lfs/unlock_file_service_spec.rb
View file @
f684346b
...
...
@@ -2,10 +2,12 @@ require 'spec_helper'
describe
Lfs
::
UnlockFileService
do
let
(
:project
)
{
create
(
:project
)
}
let
(
:user
)
{
create
(
:user
)
}
let!
(
:lock
)
{
create
(
:lfs_file_lock
,
user:
user
,
project:
project
)
}
let
(
:current_user
)
{
create
(
:user
)
}
let
(
:lock_author
)
{
create
(
:user
)
}
let!
(
:lock
)
{
create
(
:lfs_file_lock
,
user:
lock_author
,
project:
project
)
}
let
(
:params
)
{
{}
}
subject
{
described_class
.
new
(
project
,
user
,
params
)
}
subject
{
described_class
.
new
(
project
,
current_
user
,
params
)
}
describe
'#execute'
do
context
'when lock does not exists'
do
...
...
@@ -19,6 +21,7 @@ describe Lfs::UnlockFileService do
end
context
'when unlocked by the author'
do
let
(
:current_user
)
{
lock_author
}
let
(
:params
)
{
{
id:
lock
.
id
}
}
it
"succeeds"
do
...
...
@@ -30,13 +33,14 @@ describe Lfs::UnlockFileService do
end
context
'when unlocked by a different user'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:current_user
)
{
create
(
:user
)
}
let
(
:params
)
{
{
id:
lock
.
id
}
}
it
"doesn't succeed"
do
result
=
subject
.
execute
expect
(
result
[
:status
]).
to
eq
(
:error
)
expect
(
result
[
:message
]).
to
match
(
/is locked by GitLab User
#{
use
r
.
id
}
/
)
expect
(
result
[
:message
]).
to
match
(
/is locked by GitLab User
#{
lock_autho
r
.
id
}
/
)
expect
(
result
[
:http_status
]).
to
eq
(
403
)
end
end
...
...
@@ -51,7 +55,7 @@ describe Lfs::UnlockFileService do
end
context
'by a regular user'
do
let
(
:user
)
{
developer
}
let
(
:
current_
user
)
{
developer
}
let
(
:params
)
do
{
id:
lock
.
id
,
force:
true
}
...
...
@@ -67,7 +71,7 @@ describe Lfs::UnlockFileService do
end
context
'by a master user'
do
let
(
:
user
)
{
develop
er
}
let
(
:
current_user
)
{
mast
er
}
let
(
:params
)
do
{
id:
lock
.
id
,
force:
true
}
...
...
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