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
c2ea4941
Commit
c2ea4941
authored
Mar 09, 2018
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor specs
parent
1f311a9c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
15 deletions
+27
-15
spec/lib/gitlab/project_transfer_spec.rb
spec/lib/gitlab/project_transfer_spec.rb
+24
-12
spec/models/namespace_spec.rb
spec/models/namespace_spec.rb
+3
-3
No files found.
spec/lib/gitlab/project_transfer_spec.rb
View file @
c2ea4941
...
@@ -21,10 +21,12 @@ describe Gitlab::ProjectTransfer do
...
@@ -21,10 +21,12 @@ describe Gitlab::ProjectTransfer do
describe
'#move_project'
do
describe
'#move_project'
do
it
"moves project upload to another namespace"
do
it
"moves project upload to another namespace"
do
FileUtils
.
mkdir_p
(
File
.
join
(
@root_dir
,
@namespace_path_was
,
@project_path
))
path_to_be_moved
=
File
.
join
(
@root_dir
,
@namespace_path_was
,
@project_path
)
expected_path
=
File
.
join
(
@root_dir
,
@namespace_path
,
@project_path
)
FileUtils
.
mkdir_p
(
path_to_be_moved
)
@project_transfer
.
move_project
(
@project_path
,
@namespace_path_was
,
@namespace_path
)
@project_transfer
.
move_project
(
@project_path
,
@namespace_path_was
,
@namespace_path
)
expected_path
=
File
.
join
(
@root_dir
,
@namespace_path
,
@project_path
)
expect
(
Dir
.
exist?
(
expected_path
)).
to
be_truthy
expect
(
Dir
.
exist?
(
expected_path
)).
to
be_truthy
end
end
end
end
...
@@ -33,10 +35,12 @@ describe Gitlab::ProjectTransfer do
...
@@ -33,10 +35,12 @@ describe Gitlab::ProjectTransfer do
context
'when moving namespace from root into another namespace'
do
context
'when moving namespace from root into another namespace'
do
it
"moves namespace projects' upload"
do
it
"moves namespace projects' upload"
do
child_namespace
=
'test_child_namespace'
child_namespace
=
'test_child_namespace'
FileUtils
.
mkdir_p
(
File
.
join
(
@root_dir
,
child_namespace
,
@project_path
))
path_to_be_moved
=
File
.
join
(
@root_dir
,
child_namespace
,
@project_path
)
expected_path
=
File
.
join
(
@root_dir
,
@namespace_path
,
child_namespace
,
@project_path
)
FileUtils
.
mkdir_p
(
path_to_be_moved
)
@project_transfer
.
move_namespace
(
child_namespace
,
nil
,
@namespace_path
)
@project_transfer
.
move_namespace
(
child_namespace
,
nil
,
@namespace_path
)
expected_path
=
File
.
join
(
@root_dir
,
@namespace_path
,
child_namespace
,
@project_path
)
expect
(
Dir
.
exist?
(
expected_path
)).
to
be_truthy
expect
(
Dir
.
exist?
(
expected_path
)).
to
be_truthy
end
end
end
end
...
@@ -44,10 +48,12 @@ describe Gitlab::ProjectTransfer do
...
@@ -44,10 +48,12 @@ describe Gitlab::ProjectTransfer do
context
'when moving namespace from one parent to another'
do
context
'when moving namespace from one parent to another'
do
it
"moves namespace projects' upload"
do
it
"moves namespace projects' upload"
do
child_namespace
=
'test_child_namespace'
child_namespace
=
'test_child_namespace'
FileUtils
.
mkdir_p
(
File
.
join
(
@root_dir
,
@namespace_path_was
,
child_namespace
,
@project_path
))
path_to_be_moved
=
File
.
join
(
@root_dir
,
@namespace_path_was
,
child_namespace
,
@project_path
)
expected_path
=
File
.
join
(
@root_dir
,
@namespace_path
,
child_namespace
,
@project_path
)
FileUtils
.
mkdir_p
(
path_to_be_moved
)
@project_transfer
.
move_namespace
(
child_namespace
,
@namespace_path_was
,
@namespace_path
)
@project_transfer
.
move_namespace
(
child_namespace
,
@namespace_path_was
,
@namespace_path
)
expected_path
=
File
.
join
(
@root_dir
,
@namespace_path
,
child_namespace
,
@project_path
)
expect
(
Dir
.
exist?
(
expected_path
)).
to
be_truthy
expect
(
Dir
.
exist?
(
expected_path
)).
to
be_truthy
end
end
end
end
...
@@ -55,10 +61,12 @@ describe Gitlab::ProjectTransfer do
...
@@ -55,10 +61,12 @@ describe Gitlab::ProjectTransfer do
context
'when moving namespace from having a parent to root'
do
context
'when moving namespace from having a parent to root'
do
it
"moves namespace projects' upload"
do
it
"moves namespace projects' upload"
do
child_namespace
=
'test_child_namespace'
child_namespace
=
'test_child_namespace'
FileUtils
.
mkdir_p
(
File
.
join
(
@root_dir
,
@namespace_path_was
,
child_namespace
,
@project_path
))
path_to_be_moved
=
File
.
join
(
@root_dir
,
@namespace_path_was
,
child_namespace
,
@project_path
)
expected_path
=
File
.
join
(
@root_dir
,
child_namespace
,
@project_path
)
FileUtils
.
mkdir_p
(
path_to_be_moved
)
@project_transfer
.
move_namespace
(
child_namespace
,
@namespace_path_was
,
nil
)
@project_transfer
.
move_namespace
(
child_namespace
,
@namespace_path_was
,
nil
)
expected_path
=
File
.
join
(
@root_dir
,
child_namespace
,
@project_path
)
expect
(
Dir
.
exist?
(
expected_path
)).
to
be_truthy
expect
(
Dir
.
exist?
(
expected_path
)).
to
be_truthy
end
end
end
end
...
@@ -66,20 +74,24 @@ describe Gitlab::ProjectTransfer do
...
@@ -66,20 +74,24 @@ describe Gitlab::ProjectTransfer do
describe
'#rename_project'
do
describe
'#rename_project'
do
it
"renames project"
do
it
"renames project"
do
FileUtils
.
mkdir_p
(
File
.
join
(
@root_dir
,
@namespace_path
,
@project_path_was
))
path_to_be_moved
=
File
.
join
(
@root_dir
,
@namespace_path
,
@project_path_was
)
expected_path
=
File
.
join
(
@root_dir
,
@namespace_path
,
@project_path
)
FileUtils
.
mkdir_p
(
path_to_be_moved
)
@project_transfer
.
rename_project
(
@project_path_was
,
@project_path
,
@namespace_path
)
@project_transfer
.
rename_project
(
@project_path_was
,
@project_path
,
@namespace_path
)
expected_path
=
File
.
join
(
@root_dir
,
@namespace_path
,
@project_path
)
expect
(
Dir
.
exist?
(
expected_path
)).
to
be_truthy
expect
(
Dir
.
exist?
(
expected_path
)).
to
be_truthy
end
end
end
end
describe
'#rename_namespace'
do
describe
'#rename_namespace'
do
it
"renames namespace"
do
it
"renames namespace"
do
FileUtils
.
mkdir_p
(
File
.
join
(
@root_dir
,
@namespace_path_was
,
@project_path
))
path_to_be_moved
=
File
.
join
(
@root_dir
,
@namespace_path_was
,
@project_path
)
expected_path
=
File
.
join
(
@root_dir
,
@namespace_path
,
@project_path
)
FileUtils
.
mkdir_p
(
path_to_be_moved
)
@project_transfer
.
rename_namespace
(
@namespace_path_was
,
@namespace_path
)
@project_transfer
.
rename_namespace
(
@namespace_path_was
,
@namespace_path
)
expected_path
=
File
.
join
(
@root_dir
,
@namespace_path
,
@project_path
)
expect
(
Dir
.
exist?
(
expected_path
)).
to
be_truthy
expect
(
Dir
.
exist?
(
expected_path
)).
to
be_truthy
end
end
end
end
...
...
spec/models/namespace_spec.rb
View file @
c2ea4941
...
@@ -217,9 +217,9 @@ describe Namespace do
...
@@ -217,9 +217,9 @@ describe Namespace do
expected_upload_path
=
File
.
join
(
uploads_dir
,
namespace_path
,
'the-project'
)
expected_upload_path
=
File
.
join
(
uploads_dir
,
namespace_path
,
'the-project'
)
expected_pages_path
=
File
.
join
(
pages_dir
,
namespace_path
,
'the-project'
)
expected_pages_path
=
File
.
join
(
pages_dir
,
namespace_path
,
'the-project'
)
expect
(
File
.
directory?
(
expected_repository_path
)).
to
be
(
true
)
expect
(
File
.
directory?
(
expected_repository_path
)).
to
be
_truthy
expect
(
File
.
directory?
(
expected_upload_path
)).
to
be
(
true
)
expect
(
File
.
directory?
(
expected_upload_path
)).
to
be
_truthy
expect
(
File
.
directory?
(
expected_pages_path
)).
to
be
(
true
)
expect
(
File
.
directory?
(
expected_pages_path
)).
to
be
_truthy
end
end
before
do
before
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