summaryrefslogtreecommitdiff
path: root/spec/services/repositories
diff options
context:
space:
mode:
Diffstat (limited to 'spec/services/repositories')
-rw-r--r--spec/services/repositories/destroy_service_spec.rb20
1 files changed, 19 insertions, 1 deletions
diff --git a/spec/services/repositories/destroy_service_spec.rb b/spec/services/repositories/destroy_service_spec.rb
index 30ec84b44e7..81bda2130a6 100644
--- a/spec/services/repositories/destroy_service_spec.rb
+++ b/spec/services/repositories/destroy_service_spec.rb
@@ -9,7 +9,7 @@ RSpec.describe Repositories::DestroyService do
let(:path) { repository.disk_path }
let(:remove_path) { "#{path}+#{project.id}#{described_class::DELETED_FLAG}" }
- subject { described_class.new(project.repository).execute }
+ subject { described_class.new(repository).execute }
it 'moves the repository to a +deleted folder' do
expect(project.gitlab_shell.repository_exists?(project.repository_storage, path + '.git')).to be_truthy
@@ -92,4 +92,22 @@ RSpec.describe Repositories::DestroyService do
service.execute
end
end
+
+ context 'with a project wiki repository' do
+ let(:project) { create(:project, :wiki_repo) }
+ let(:repository) { project.wiki.repository }
+
+ it 'schedules the repository deletion' do
+ subject
+
+ expect(Repositories::ShellDestroyService).to receive(:new).with(repository).and_call_original
+
+ expect(GitlabShellWorker).to receive(:perform_in)
+ .with(Repositories::ShellDestroyService::REPO_REMOVAL_DELAY, :remove_repository, project.repository_storage, remove_path)
+
+ # Because GitlabShellWorker is inside a run_after_commit callback we need to
+ # trigger the callback
+ project.touch
+ end
+ end
end