Refactor specs
This commit is contained in:
parent
1f311a9caa
commit
c2ea494187
|
|
@ -21,10 +21,12 @@ describe Gitlab::ProjectTransfer do
|
|||
|
||||
describe '#move_project' 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)
|
||||
|
||||
expected_path = File.join(@root_dir, @namespace_path, @project_path)
|
||||
expect(Dir.exist?(expected_path)).to be_truthy
|
||||
end
|
||||
end
|
||||
|
|
@ -33,10 +35,12 @@ describe Gitlab::ProjectTransfer 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))
|
||||
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)
|
||||
|
||||
expected_path = File.join(@root_dir, @namespace_path, child_namespace, @project_path)
|
||||
expect(Dir.exist?(expected_path)).to be_truthy
|
||||
end
|
||||
end
|
||||
|
|
@ -44,10 +48,12 @@ describe Gitlab::ProjectTransfer do
|
|||
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))
|
||||
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)
|
||||
|
||||
expected_path = File.join(@root_dir, @namespace_path, child_namespace, @project_path)
|
||||
expect(Dir.exist?(expected_path)).to be_truthy
|
||||
end
|
||||
end
|
||||
|
|
@ -55,10 +61,12 @@ describe Gitlab::ProjectTransfer do
|
|||
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))
|
||||
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)
|
||||
|
||||
expected_path = File.join(@root_dir, child_namespace, @project_path)
|
||||
expect(Dir.exist?(expected_path)).to be_truthy
|
||||
end
|
||||
end
|
||||
|
|
@ -66,20 +74,24 @@ describe Gitlab::ProjectTransfer do
|
|||
|
||||
describe '#rename_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)
|
||||
|
||||
expected_path = File.join(@root_dir, @namespace_path, @project_path)
|
||||
expect(Dir.exist?(expected_path)).to be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
describe '#rename_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)
|
||||
|
||||
expected_path = File.join(@root_dir, @namespace_path, @project_path)
|
||||
expect(Dir.exist?(expected_path)).to be_truthy
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -217,9 +217,9 @@ describe Namespace do
|
|||
expected_upload_path = File.join(uploads_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_upload_path)).to be(true)
|
||||
expect(File.directory?(expected_pages_path)).to be(true)
|
||||
expect(File.directory?(expected_repository_path)).to be_truthy
|
||||
expect(File.directory?(expected_upload_path)).to be_truthy
|
||||
expect(File.directory?(expected_pages_path)).to be_truthy
|
||||
end
|
||||
|
||||
before do
|
||||
|
|
|
|||
Loading…
Reference in New Issue