2021-03-08 18:12:59 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
RSpec.shared_examples 'concerning versionless param' do
|
|
|
|
let_it_be(:versionless_package) { create(:maven_package, project: project, version: nil) }
|
|
|
|
|
|
|
|
it { is_expected.not_to include(versionless_package) }
|
|
|
|
|
|
|
|
context 'with valid include_versionless param' do
|
|
|
|
let(:params) { { include_versionless: true } }
|
|
|
|
|
|
|
|
it { is_expected.to include(versionless_package) }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with empty include_versionless param' do
|
|
|
|
let(:params) { { include_versionless: '' } }
|
|
|
|
|
|
|
|
it { is_expected.not_to include(versionless_package) }
|
|
|
|
end
|
|
|
|
end
|
2021-03-11 19:13:27 +05:30
|
|
|
|
|
|
|
RSpec.shared_examples 'concerning package statuses' do
|
|
|
|
let_it_be(:hidden_package) { create(:maven_package, :hidden, project: project) }
|
|
|
|
|
|
|
|
context 'hidden packages' do
|
|
|
|
it { is_expected.not_to include(hidden_package) }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with status param' do
|
|
|
|
let(:params) { { status: :hidden } }
|
|
|
|
|
|
|
|
it { is_expected.to match_array([hidden_package]) }
|
|
|
|
end
|
|
|
|
|
|
|
|
context 'with invalid status param' do
|
|
|
|
let(:params) { { status: 'invalid_status' } }
|
|
|
|
|
|
|
|
it { expect { subject }.to raise_exception(described_class::InvalidStatusError) }
|
|
|
|
end
|
|
|
|
end
|