summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab/project_transfer_spec.rb
diff options
context:
space:
mode:
authorMichael Kozono <mkozono@gmail.com>2018-03-08 14:16:21 -0800
committerMichael Kozono <mkozono@gmail.com>2018-03-13 14:45:17 -0700
commit1f311a9caa9b3ac3d6e0cfe339390b0949632ae3 (patch)
tree93f203511872277035b2e4fe7f78d0c32bc0960a /spec/lib/gitlab/project_transfer_spec.rb
parentea01d4752f041afead7677872ba076682a6620db (diff)
downloadgitlab-ce-1f311a9caa9b3ac3d6e0cfe339390b0949632ae3.tar.gz
Fix moving local files during namespace transfer
Diffstat (limited to 'spec/lib/gitlab/project_transfer_spec.rb')
-rw-r--r--spec/lib/gitlab/project_transfer_spec.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/lib/gitlab/project_transfer_spec.rb b/spec/lib/gitlab/project_transfer_spec.rb
index 10c5fb148cd..0688a1a5cac 100644
--- a/spec/lib/gitlab/project_transfer_spec.rb
+++ b/spec/lib/gitlab/project_transfer_spec.rb
@@ -29,6 +29,41 @@ describe Gitlab::ProjectTransfer do
end
end
+ describe '#move_namespace' do
+ context 'when moving namespace from root into another namespace' do
+ it "moves namespace projects' upload" do
+ child_namespace = 'test_child_namespace'
+ FileUtils.mkdir_p(File.join(@root_dir, child_namespace, @project_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
+ end
+ end
+
+ context 'when moving namespace from one parent to another' do
+ it "moves namespace projects' upload" do
+ child_namespace = 'test_child_namespace'
+ FileUtils.mkdir_p(File.join(@root_dir, @namespace_path_was, child_namespace, @project_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
+ end
+ end
+
+ context 'when moving namespace from having a parent to root' do
+ it "moves namespace projects' upload" do
+ child_namespace = 'test_child_namespace'
+ FileUtils.mkdir_p(File.join(@root_dir, @namespace_path_was, child_namespace, @project_path))
+ @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
+ end
+ end
+ end
+
describe '#rename_project' do
it "renames project" do
FileUtils.mkdir_p(File.join(@root_dir, @namespace_path, @project_path_was))