debian-mirror-gitlab/spec/workers/project_destroy_worker_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
809 B
Ruby
Raw Normal View History

2019-07-07 11:18:12 +05:30
# frozen_string_literal: true
2016-09-13 17:45:13 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe ProjectDestroyWorker do
2017-09-10 17:25:29 +05:30
let(:project) { create(:project, :repository, pending_delete: true) }
2022-11-25 23:54:43 +05:30
let!(:repository) { project.repository.raw }
2016-09-13 17:45:13 +05:30
2017-08-17 22:00:37 +05:30
subject { described_class.new }
2016-09-13 17:45:13 +05:30
2017-09-10 17:25:29 +05:30
describe '#perform' do
it 'deletes the project' do
2022-04-04 11:22:00 +05:30
subject.perform(project.id, project.first_owner.id, {})
2016-09-13 17:45:13 +05:30
expect(Project.all).not_to include(project)
2022-11-25 23:54:43 +05:30
expect(repository).not_to exist
2016-09-13 17:45:13 +05:30
end
2017-09-10 17:25:29 +05:30
it 'does not raise error when project could not be found' do
expect do
2022-04-04 11:22:00 +05:30
subject.perform(-1, project.first_owner.id, {})
2017-09-10 17:25:29 +05:30
end.not_to raise_error
end
it 'does not raise error when user could not be found' do
expect do
subject.perform(project.id, -1, {})
end.not_to raise_error
end
2016-09-13 17:45:13 +05:30
end
end