2015-03-31 07:37:21 -04:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe ArchiveRepositoryService do
|
|
|
|
let(:project) { create(:project) }
|
|
|
|
subject { ArchiveRepositoryService.new(project, "master", "zip") }
|
|
|
|
|
|
|
|
describe "#execute" do
|
|
|
|
it "cleans old archives" do
|
2015-10-16 12:39:17 -04:00
|
|
|
expect(RepositoryArchiveCacheWorker).to receive(:perform_async)
|
2015-03-31 07:37:21 -04:00
|
|
|
|
|
|
|
subject.execute(timeout: 0.0)
|
|
|
|
end
|
|
|
|
|
|
|
|
context "when the repository doesn't have an archive file path" do
|
|
|
|
before do
|
2015-10-14 06:17:59 -04:00
|
|
|
allow(project.repository).to receive(:archive_metadata).and_return(Hash.new)
|
2015-03-31 07:37:21 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
it "raises an error" do
|
2015-06-23 04:44:03 -04:00
|
|
|
expect { subject.execute(timeout: 0.0) }.to raise_error(RuntimeError)
|
2015-03-31 07:37:21 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|