diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-07-20 15:26:25 +0300 |
commit | a09983ae35713f5a2bbb100981116d31ce99826e (patch) | |
tree | 2ee2af7bd104d57086db360a7e6d8c9d5d43667a /spec/support/shared_contexts/presenters/nuget_shared_context.rb | |
parent | 18c5ab32b738c0b6ecb4d0df3994000482f34bd8 (diff) |
Add latest changes from gitlab-org/gitlab@13-2-stable-ee
Diffstat (limited to 'spec/support/shared_contexts/presenters/nuget_shared_context.rb')
-rw-r--r-- | spec/support/shared_contexts/presenters/nuget_shared_context.rb | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/support/shared_contexts/presenters/nuget_shared_context.rb b/spec/support/shared_contexts/presenters/nuget_shared_context.rb new file mode 100644 index 00000000000..dd381db5a8b --- /dev/null +++ b/spec/support/shared_contexts/presenters/nuget_shared_context.rb @@ -0,0 +1,41 @@ +# frozen_string_literal: true + +RSpec.shared_context 'with expected presenters dependency groups' do + def expected_dependency_groups(project_id, package_name, package_version) + [ + { + id: "http://localhost/api/v4/projects/#{project_id}/packages/nuget/metadata/#{package_name}/#{package_version}.json#dependencyGroup/.netstandard2.0", + target_framework: '.NETStandard2.0', + type: 'PackageDependencyGroup', + dependencies: [ + { + id: "http://localhost/api/v4/projects/#{project_id}/packages/nuget/metadata/#{package_name}/#{package_version}.json#dependencyGroup/.netstandard2.0/newtonsoft.json", + range: '12.0.3', + name: 'Newtonsoft.Json', + type: 'PackageDependency' + } + ] + }, + { + id: "http://localhost/api/v4/projects/#{project_id}/packages/nuget/metadata/#{package_name}/#{package_version}.json#dependencyGroup", + type: 'PackageDependencyGroup', + dependencies: [ + { + id: "http://localhost/api/v4/projects/#{project_id}/packages/nuget/metadata/#{package_name}/#{package_version}.json#dependencyGroup/castle.core", + range: '4.4.1', + name: 'Castle.Core', + type: 'PackageDependency' + } + ] + } + ] + end + + def create_dependencies_for(package) + dependency1 = Packages::Dependency.find_by(name: 'Newtonsoft.Json', version_pattern: '12.0.3') || create(:packages_dependency, name: 'Newtonsoft.Json', version_pattern: '12.0.3') + dependency2 = Packages::Dependency.find_by(name: 'Castle.Core', version_pattern: '4.4.1') || create(:packages_dependency, name: 'Castle.Core', version_pattern: '4.4.1') + + create(:packages_dependency_link, :with_nuget_metadatum, package: package, dependency: dependency1) + create(:packages_dependency_link, package: package, dependency: dependency2) + end +end |