blob: 27c389b531253811b64396f65535942f7663ea41 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Packages::Debian::FindOrCreateIncomingService, feature_category: :package_registry do
let_it_be(:project) { create(:project) }
let_it_be(:user) { create(:user) }
subject(:service) { described_class.new(project, user) }
describe '#execute' do
subject(:package) { service.execute }
context 'run once' do
it 'creates a new package', :aggregate_failures do
expect(package).to be_valid
expect(package.project_id).to eq(project.id)
expect(package.creator_id).to eq(user.id)
expect(package.name).to eq('incoming')
expect(package.version).to be_nil
expect(package.package_type).to eq('debian')
expect(package.debian_incoming?).to be_truthy
end
it_behaves_like 'assigns the package creator'
end
context 'run twice' do
let!(:package2) { service.execute }
it 'returns the same object' do
expect(package2.id).to eq(package.id)
end
end
end
end
|