summaryrefslogtreecommitdiff
path: root/spec/support
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-02-15 08:58:20 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-02-15 08:58:20 +0000
commit59c9ff627603da03f6a7c330d57a2c765b3c24a3 (patch)
treedd8f3a2fbc9564818a77d2d8798fcc464d220e8e /spec/support
parent30b4659f2c485885324fd8d67fcd92a2939310a3 (diff)
downloadgitlab-ce-59c9ff627603da03f6a7c330d57a2c765b3c24a3.tar.gz
Add latest changes from gitlab-org/gitlab@14-7-stable-ee
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/shared_examples/requests/api/conan_packages_shared_examples.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/support/shared_examples/requests/api/conan_packages_shared_examples.rb b/spec/support/shared_examples/requests/api/conan_packages_shared_examples.rb
index 71f3a0235be..b30c4186f0d 100644
--- a/spec/support/shared_examples/requests/api/conan_packages_shared_examples.rb
+++ b/spec/support/shared_examples/requests/api/conan_packages_shared_examples.rb
@@ -777,6 +777,32 @@ RSpec.shared_examples 'uploads a package file' do
subject
end
+
+ context 'with existing package' do
+ let!(:existing_package) { create(:conan_package, name: 'foo', version: 'bar', project: project) }
+
+ before do
+ existing_package.conan_metadatum.update!(package_username: project.full_path.tr('/', '+'), package_channel: 'baz')
+ end
+
+ it 'does not create a new package' do
+ expect { subject }
+ .to not_change { project.packages.count }
+ .and not_change { Packages::Conan::Metadatum.count }
+ .and change { Packages::PackageFile.count }.by(1)
+ end
+
+ context 'marked as pending_destruction' do
+ it 'does not create a new package' do
+ existing_package.pending_destruction!
+
+ expect { subject }
+ .to change { project.packages.count }.by(1)
+ .and change { Packages::Conan::Metadatum.count }.by(1)
+ .and change { Packages::PackageFile.count }.by(1)
+ end
+ end
+ end
end
end