summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Kozono <mkozono@gmail.com>2018-03-09 09:17:14 -0800
committerMichael Kozono <mkozono@gmail.com>2018-03-13 14:45:17 -0700
commitc2ea494187b09b9cd036c5c882232fff017eef1b (patch)
tree35c92fdad384922b8dfa1aceee8bc34ee5c2660d
parent1f311a9caa9b3ac3d6e0cfe339390b0949632ae3 (diff)
downloadgitlab-ce-c2ea494187b09b9cd036c5c882232fff017eef1b.tar.gz
Refactor specs
-rw-r--r--spec/lib/gitlab/project_transfer_spec.rb36
-rw-r--r--spec/models/namespace_spec.rb6
2 files changed, 27 insertions, 15 deletions
diff --git a/spec/lib/gitlab/project_transfer_spec.rb b/spec/lib/gitlab/project_transfer_spec.rb
index 0688a1a5cac..0b9b1f537b5 100644
--- a/spec/lib/gitlab/project_transfer_spec.rb
+++ b/spec/lib/gitlab/project_transfer_spec.rb
@@ -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
diff --git a/spec/models/namespace_spec.rb b/spec/models/namespace_spec.rb
index 857715ced43..b3bbd8a59aa 100644
--- a/spec/models/namespace_spec.rb
+++ b/spec/models/namespace_spec.rb
@@ -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