2019-03-30 03:15:48 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-08-03 19:45:06 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
2020-06-24 11:08:50 -04:00
|
|
|
RSpec.describe ProjectDestroyWorker do
|
2017-06-29 07:43:01 -04:00
|
|
|
let(:project) { create(:project, :repository, pending_delete: true) }
|
2018-06-05 11:58:28 -04:00
|
|
|
let(:path) do
|
|
|
|
Gitlab::GitalyClient::StorageSettings.allow_disk_access do
|
|
|
|
project.repository.path_to_repo
|
|
|
|
end
|
|
|
|
end
|
2016-08-03 19:45:06 -04:00
|
|
|
|
2017-05-01 11:13:33 -04:00
|
|
|
subject { described_class.new }
|
2016-08-03 19:45:06 -04:00
|
|
|
|
2017-06-29 07:43:01 -04:00
|
|
|
describe '#perform' do
|
|
|
|
it 'deletes the project' do
|
2017-01-27 21:50:25 -05:00
|
|
|
subject.perform(project.id, project.owner.id, {})
|
2016-08-03 19:45:06 -04:00
|
|
|
|
|
|
|
expect(Project.all).not_to include(project)
|
|
|
|
expect(Dir.exist?(path)).to be_falsey
|
|
|
|
end
|
|
|
|
|
2017-07-18 11:09:14 -04:00
|
|
|
it 'does not raise error when project could not be found' do
|
|
|
|
expect do
|
|
|
|
subject.perform(-1, project.owner.id, {})
|
|
|
|
end.not_to raise_error
|
|
|
|
end
|
2017-06-29 07:43:01 -04:00
|
|
|
|
2017-07-18 11:09:14 -04:00
|
|
|
it 'does not raise error when user could not be found' do
|
|
|
|
expect do
|
|
|
|
subject.perform(project.id, -1, {})
|
|
|
|
end.not_to raise_error
|
2017-06-29 07:43:01 -04:00
|
|
|
end
|
2016-08-03 19:45:06 -04:00
|
|
|
end
|
|
|
|
end
|