Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2016-08-04 02:45:06 +0300
committerStan Hu <stanhu@gmail.com>2016-08-04 03:07:38 +0300
commit443ae8c4e6682cd66eab0a2a7ec6ef913c0d684c (patch)
treee0db1181dc13db0f30cf2c6f6f2c095595c672ee /spec/workers/project_destroy_worker_spec.rb
parent6a9283600cd4a11b97fe26772e68095d8dc854bd (diff)
Fix skip_repo parameter being ignored when destroying a namespace
When destroying a namespace, the `skip_repo` parameter is supposed to prevent the repository directory from being destroyed and allow the namespace after_destroy hook to run. If the namespace fails to be deleted for some reason, we could be left with repositories that are deleted with existing projects.
Diffstat (limited to 'spec/workers/project_destroy_worker_spec.rb')
-rw-r--r--spec/workers/project_destroy_worker_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/workers/project_destroy_worker_spec.rb b/spec/workers/project_destroy_worker_spec.rb
new file mode 100644
index 00000000000..1b910d9b91e
--- /dev/null
+++ b/spec/workers/project_destroy_worker_spec.rb
@@ -0,0 +1,24 @@
+require 'spec_helper'
+
+describe ProjectDestroyWorker do
+ let(:project) { create(:project) }
+ let(:path) { project.repository.path_to_repo }
+
+ subject { ProjectDestroyWorker.new }
+
+ describe "#perform" do
+ it "deletes the project" do
+ subject.perform(project.id, project.owner, {})
+
+ expect(Project.all).not_to include(project)
+ expect(Dir.exist?(path)).to be_falsey
+ end
+
+ it "deletes the project but skips repo deletion" do
+ subject.perform(project.id, project.owner, { "skip_repo" => true })
+
+ expect(Project.all).not_to include(project)
+ expect(Dir.exist?(path)).to be_truthy
+ end
+ end
+end