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

25 lines
654 B
Ruby
Raw Normal View History

2016-09-13 17:45:13 +05:30
require 'spec_helper'
describe ProjectDestroyWorker do
2017-08-17 22:00:37 +05:30
let(:project) { create(:project, :repository) }
2016-09-13 17:45:13 +05:30
let(:path) { project.repository.path_to_repo }
2017-08-17 22:00:37 +05:30
subject { described_class.new }
2016-09-13 17:45:13 +05:30
describe "#perform" do
it "deletes the project" do
2017-08-17 22:00:37 +05:30
subject.perform(project.id, project.owner.id, {})
2016-09-13 17:45:13 +05:30
expect(Project.all).not_to include(project)
expect(Dir.exist?(path)).to be_falsey
end
it "deletes the project but skips repo deletion" do
2017-08-17 22:00:37 +05:30
subject.perform(project.id, project.owner.id, { "skip_repo" => true })
2016-09-13 17:45:13 +05:30
expect(Project.all).not_to include(project)
expect(Dir.exist?(path)).to be_truthy
end
end
end