diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-30 03:10:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-30 03:10:29 +0300 |
commit | d1797e00cdbcfb900f28cad6ba91839d82ddbe1e (patch) | |
tree | c831c8c2d94d12930129a57c9c883479437838d8 /spec/services/packages/debian | |
parent | 89d84b76a93353a8b614860c3b3bccc71917aeeb (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/services/packages/debian')
-rw-r--r-- | spec/services/packages/debian/get_or_create_incoming_service_spec.rb | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/spec/services/packages/debian/get_or_create_incoming_service_spec.rb b/spec/services/packages/debian/get_or_create_incoming_service_spec.rb new file mode 100644 index 00000000000..ab99b091246 --- /dev/null +++ b/spec/services/packages/debian/get_or_create_incoming_service_spec.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Packages::Debian::GetOrCreateIncomingService 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 |