2016-08-03 19:45:06 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe ProjectDestroyWorker do
|
2017-03-27 16:42:08 -04:00
|
|
|
let(:project) { create(:project, :repository) }
|
2016-08-03 19:45:06 -04:00
|
|
|
let(:path) { project.repository.path_to_repo }
|
|
|
|
|
2017-05-01 11:13:33 -04:00
|
|
|
subject { described_class.new }
|
2016-08-03 19:45:06 -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
|
|
|
|
|
|
|
|
it "deletes the project but skips repo deletion" do
|
2017-01-27 21:50:25 -05:00
|
|
|
subject.perform(project.id, project.owner.id, { "skip_repo" => true })
|
2016-08-03 19:45:06 -04:00
|
|
|
|
|
|
|
expect(Project.all).not_to include(project)
|
|
|
|
expect(Dir.exist?(path)).to be_truthy
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|