diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-16 21:25:58 +0300 |
commit | a5f4bba440d7f9ea47046a0a561d49adf0a1e6d4 (patch) | |
tree | fb69158581673816a8cd895f9d352dcb3c678b1e /spec/support/shared_contexts/graphql/requests/packages_shared_context.rb | |
parent | d16b2e8639e99961de6ddc93909f3bb5c1445ba1 (diff) |
Add latest changes from gitlab-org/gitlab@14-0-stable-eev14.0.0-rc42
Diffstat (limited to 'spec/support/shared_contexts/graphql/requests/packages_shared_context.rb')
-rw-r--r-- | spec/support/shared_contexts/graphql/requests/packages_shared_context.rb | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/spec/support/shared_contexts/graphql/requests/packages_shared_context.rb b/spec/support/shared_contexts/graphql/requests/packages_shared_context.rb new file mode 100644 index 00000000000..334b11c9f6e --- /dev/null +++ b/spec/support/shared_contexts/graphql/requests/packages_shared_context.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +RSpec.shared_context 'package details setup' do + let_it_be(:project) { create(:project) } + let_it_be(:package) { create(:package, project: project) } + + let(:package_global_id) { global_id_of(package) } + + let(:depth) { 3 } + let(:excluded) { %w[metadata apiFuzzingCiConfiguration pipeline packageFiles] } + let(:package_files) { all_graphql_fields_for('PackageFile') } + let(:user) { project.owner } + let(:package_details) { graphql_data_at(:package) } + let(:metadata_response) { graphql_data_at(:package, :metadata) } + let(:first_file) { package.package_files.find { |f| global_id_of(f) == first_file_response['id'] } } + let(:package_files_response) { graphql_data_at(:package, :package_files, :nodes) } + let(:first_file_response) { graphql_data_at(:package, :package_files, :nodes, 0)} + let(:first_file_response_metadata) { graphql_data_at(:package, :package_files, :nodes, 0, :file_metadata)} + + let(:query) do + graphql_query_for(:package, { id: package_global_id }, <<~FIELDS) + #{all_graphql_fields_for('PackageDetailsType', max_depth: depth, excluded: excluded)} + metadata { + #{metadata} + } + packageFiles { + nodes { + #{package_files} + } + } + FIELDS + end +end |