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
f879c587
Commit
f879c587
authored
Oct 05, 2017
by
Zeger-Jan van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix namespace deletion tests
parent
4656283c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
14 deletions
+18
-14
lib/gitlab/shell.rb
lib/gitlab/shell.rb
+2
-0
spec/controllers/admin/users_controller_spec.rb
spec/controllers/admin/users_controller_spec.rb
+1
-1
spec/models/namespace_spec.rb
spec/models/namespace_spec.rb
+15
-13
No files found.
lib/gitlab/shell.rb
View file @
f879c587
...
@@ -271,6 +271,8 @@ module Gitlab
...
@@ -271,6 +271,8 @@ module Gitlab
FileUtils
.
mv
(
full_path
(
storage
,
old_name
),
full_path
(
storage
,
new_name
))
FileUtils
.
mv
(
full_path
(
storage
,
old_name
),
full_path
(
storage
,
new_name
))
end
end
end
end
rescue
GRPC
::
InvalidArgument
false
end
end
def
url_to_repo
(
path
)
def
url_to_repo
(
path
)
...
...
spec/controllers/admin/users_controller_spec.rb
View file @
f879c587
...
@@ -2,7 +2,7 @@ require 'spec_helper'
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
Admin
::
UsersController
do
describe
Admin
::
UsersController
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
l
et
(
:admin
)
{
create
(
:admin
)
}
s
et
(
:admin
)
{
create
(
:admin
)
}
before
do
before
do
sign_in
(
admin
)
sign_in
(
admin
)
...
...
spec/models/namespace_spec.rb
View file @
f879c587
...
@@ -152,22 +152,24 @@ describe Namespace do
...
@@ -152,22 +152,24 @@ describe Namespace do
end
end
describe
'#move_dir'
do
describe
'#move_dir'
do
let
(
:namespace
)
{
create
(
:namespace
)
}
let!
(
:project
)
{
create
(
:project_empty_repo
,
namespace:
namespace
)
}
before
do
before
do
@namespace
=
create
:namespace
allow
(
namespace
).
to
receive
(
:path_changed?
).
and_return
(
true
)
@project
=
create
(
:project_empty_repo
,
namespace:
@namespace
)
allow
(
@namespace
).
to
receive
(
:path_changed?
).
and_return
(
true
)
end
end
it
"raises error when directory exists"
do
it
"raises error when directory exists"
do
expect
{
@
namespace
.
move_dir
}.
to
raise_error
(
"namespace directory cannot be moved"
)
expect
{
namespace
.
move_dir
}.
to
raise_error
(
"namespace directory cannot be moved"
)
end
end
it
"moves dir if path changed"
do
it
"moves dir if path changed"
do
new_path
=
@namespace
.
full_path
+
"_new"
new_path
=
namespace
.
full_path
+
"_new"
allow
(
@namespace
).
to
receive
(
:full_path_was
).
and_return
(
@namespace
.
full_path
)
allow
(
@namespace
).
to
receive
(
:full_path
).
and_return
(
new_path
)
allow
(
namespace
).
to
receive
(
:full_path_was
).
and_return
(
namespace
.
full_path
)
expect
(
@namespace
).
to
receive
(
:remove_exports!
)
allow
(
namespace
).
to
receive
(
:full_path
).
and_return
(
new_path
)
expect
(
@namespace
.
move_dir
).
to
be_truthy
expect
(
namespace
).
to
receive
(
:remove_exports!
)
expect
(
namespace
.
move_dir
).
to
be_truthy
end
end
context
"when any project has container images"
do
context
"when any project has container images"
do
...
@@ -177,14 +179,14 @@ describe Namespace do
...
@@ -177,14 +179,14 @@ describe Namespace do
stub_container_registry_config
(
enabled:
true
)
stub_container_registry_config
(
enabled:
true
)
stub_container_registry_tags
(
repository: :any
,
tags:
[
'tag'
])
stub_container_registry_tags
(
repository: :any
,
tags:
[
'tag'
])
create
(
:project
,
namespace:
@
namespace
,
container_repositories:
[
container_repository
])
create
(
:project
,
namespace:
namespace
,
container_repositories:
[
container_repository
])
allow
(
@namespace
).
to
receive
(
:path_was
).
and_return
(
@
namespace
.
path
)
allow
(
namespace
).
to
receive
(
:path_was
).
and_return
(
namespace
.
path
)
allow
(
@
namespace
).
to
receive
(
:path
).
and_return
(
'new_path'
)
allow
(
namespace
).
to
receive
(
:path
).
and_return
(
'new_path'
)
end
end
it
'raises an error about not movable project'
do
it
'raises an error about not movable project'
do
expect
{
@
namespace
.
move_dir
}.
to
raise_error
(
/Namespace cannot be moved/
)
expect
{
namespace
.
move_dir
}.
to
raise_error
(
/Namespace cannot be moved/
)
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