2021-06-08 01:23:25 +05:30
|
|
|
# frozen_string_literal: true
|
2021-09-04 01:27:46 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2023-04-23 21:23:45 +05:30
|
|
|
RSpec.describe Packages::Debian::GenerateDistributionService, feature_category: :package_registry do
|
2023-05-27 22:25:52 +05:30
|
|
|
include_context 'with published Debian package'
|
2021-06-08 01:23:25 +05:30
|
|
|
|
2023-05-27 22:25:52 +05:30
|
|
|
let(:service) { described_class.new(distribution) }
|
2021-10-27 15:23:28 +05:30
|
|
|
|
2023-05-27 22:25:52 +05:30
|
|
|
[:project, :group].each do |container_type|
|
|
|
|
context "for #{container_type}" do
|
|
|
|
include_context 'with Debian distribution', container_type
|
2021-06-08 01:23:25 +05:30
|
|
|
|
2023-05-27 22:25:52 +05:30
|
|
|
describe '#execute' do
|
|
|
|
subject { service.execute }
|
|
|
|
|
|
|
|
let(:subject2) { described_class.new(distribution).execute }
|
|
|
|
let(:subject3) { described_class.new(distribution).execute }
|
2021-06-08 01:23:25 +05:30
|
|
|
|
2021-10-27 15:23:28 +05:30
|
|
|
it_behaves_like 'Generate Debian Distribution and component files'
|
2021-06-08 01:23:25 +05:30
|
|
|
end
|
2023-05-27 22:25:52 +05:30
|
|
|
|
|
|
|
describe '#lease_key' do
|
|
|
|
subject { service.send(:lease_key) }
|
|
|
|
|
|
|
|
let(:prefix) { "packages:debian:generate_distribution_service:" }
|
|
|
|
|
|
|
|
it 'returns an unique key' do
|
|
|
|
is_expected.to eq "#{prefix}#{container_type}_distribution:#{distribution.id}"
|
|
|
|
end
|
|
|
|
end
|
2021-06-08 01:23:25 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|