debian-mirror-gitlab/spec/requests/api/graphql/packages/maven_spec.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

55 lines
1.4 KiB
Ruby
Raw Normal View History

2021-06-08 01:23:25 +05:30
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'maven package details' do
include GraphqlHelpers
2021-09-04 01:27:46 +05:30
include_context 'package details setup'
2021-06-08 01:23:25 +05:30
2022-10-11 01:57:18 +05:30
let_it_be(:package) { create(:maven_package, :last_downloaded_at, project: project) }
2021-06-08 01:23:25 +05:30
let(:metadata) { query_graphql_fragment('MavenMetadata') }
2021-09-04 01:27:46 +05:30
shared_examples 'correct maven metadata' do
2021-06-08 01:23:25 +05:30
it 'has the correct metadata' do
2022-07-16 23:28:13 +05:30
expect(metadata_response).to match a_graphql_entity_for(
package.maven_metadatum, :path, :app_group, :app_version, :app_name
2021-06-08 01:23:25 +05:30
)
end
2021-09-04 01:27:46 +05:30
end
2021-06-08 01:23:25 +05:30
2021-09-04 01:27:46 +05:30
context 'a maven package with version' do
subject { post_graphql(query, current_user: user) }
2021-06-08 01:23:25 +05:30
2021-09-04 01:27:46 +05:30
before do
subject
2021-06-08 01:23:25 +05:30
end
2021-09-04 01:27:46 +05:30
it_behaves_like 'a package detail'
it_behaves_like 'correct maven metadata'
it_behaves_like 'a package with files'
2021-06-08 01:23:25 +05:30
end
context 'a versionless maven package' do
let_it_be(:maven_metadatum) { create(:maven_metadatum, app_version: nil) }
2022-10-11 01:57:18 +05:30
let_it_be(:package) do
create(:maven_package, :last_downloaded_at, project: project, version: nil, maven_metadatum: maven_metadatum)
end
2021-09-04 01:27:46 +05:30
subject { post_graphql(query, current_user: user) }
before do
subject
end
2021-06-08 01:23:25 +05:30
2021-09-04 01:27:46 +05:30
it_behaves_like 'a package detail'
it_behaves_like 'correct maven metadata'
it_behaves_like 'a package with files'
2021-06-08 01:23:25 +05:30
2021-09-04 01:27:46 +05:30
it 'has an empty version' do
2021-06-08 01:23:25 +05:30
subject
expect(metadata_response['appVersion']).to eq(nil)
end
end
end