debian-mirror-gitlab/spec/services/archive_repository_service_spec.rb

26 lines
676 B
Ruby
Raw Normal View History

2015-04-26 12:48:37 +05:30
require 'spec_helper'
2015-12-23 02:04:40 +05:30
describe ArchiveRepositoryService, services: true do
2015-04-26 12:48:37 +05:30
let(:project) { create(:project) }
subject { ArchiveRepositoryService.new(project, "master", "zip") }
describe "#execute" do
it "cleans old archives" do
2015-10-24 18:46:33 +05:30
expect(RepositoryArchiveCacheWorker).to receive(:perform_async)
2015-04-26 12:48:37 +05:30
subject.execute(timeout: 0.0)
end
context "when the repository doesn't have an archive file path" do
before do
2015-10-24 18:46:33 +05:30
allow(project.repository).to receive(:archive_metadata).and_return(Hash.new)
2015-04-26 12:48:37 +05:30
end
it "raises an error" do
2015-09-11 14:41:01 +05:30
expect { subject.execute(timeout: 0.0) }.to raise_error(RuntimeError)
2015-04-26 12:48:37 +05:30
end
end
end
end