gitlab-org--gitlab-foss/spec/workers/project_destroy_worker_spec.rb
Stan Hu 443ae8c4e6 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.
2016-08-03 17:07:38 -07:00

24 lines
640 B
Ruby

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