summaryrefslogtreecommitdiff
path: root/spec/migrations/move_system_upload_folder_spec.rb
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2017-08-02 15:42:36 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2017-08-11 18:15:02 +0200
commitb8ae15397f0f21b87ea2f91efb470e7e51ba8964 (patch)
tree7945caffedddd6ead14f8ae730be059d3078a1b7 /spec/migrations/move_system_upload_folder_spec.rb
parentf0f4506775d0e06b28ee55d591cb223115e3975a (diff)
downloadgitlab-ce-b8ae15397f0f21b87ea2f91efb470e7e51ba8964.tar.gz
Update migrations to move directly into the `-/system` folder
Diffstat (limited to 'spec/migrations/move_system_upload_folder_spec.rb')
-rw-r--r--spec/migrations/move_system_upload_folder_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/migrations/move_system_upload_folder_spec.rb b/spec/migrations/move_system_upload_folder_spec.rb
index b622b4e9536..d3180477db3 100644
--- a/spec/migrations/move_system_upload_folder_spec.rb
+++ b/spec/migrations/move_system_upload_folder_spec.rb
@@ -33,6 +33,15 @@ describe MoveSystemUploadFolder do
expect(File.symlink?(File.join(test_base, 'system'))).to be_truthy
expect(File.exist?(File.join(test_base, 'system', 'file'))).to be_truthy
end
+
+ it 'does not move if the target directory already exists' do
+ FileUtils.mkdir_p(File.join(test_base, '-', 'system'))
+
+ expect(FileUtils).not_to receive(:mv)
+ expect(migration).to receive(:say).with(/already exists. No need to redo the move/)
+
+ migration.up
+ end
end
describe '#down' do
@@ -58,5 +67,14 @@ describe MoveSystemUploadFolder do
expect(File.directory?(File.join(test_base, 'system'))).to be_truthy
expect(File.symlink?(File.join(test_base, 'system'))).to be_falsey
end
+
+ it 'does not move if the old directory already exists' do
+ FileUtils.mkdir_p(File.join(test_base, 'system'))
+
+ expect(FileUtils).not_to receive(:mv)
+ expect(migration).to receive(:say).with(/already exists and is not a symlink, no need to revert/)
+
+ migration.down
+ end
end
end