2020-07-10 11:09:07 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
RSpec.describe ::Packages::PackageFinder do
|
|
|
|
let_it_be(:project) { create(:project) }
|
2021-05-11 11:10:20 -04:00
|
|
|
let_it_be_with_refind(:maven_package) { create(:maven_package, project: project) }
|
2020-07-10 11:09:07 -04:00
|
|
|
|
|
|
|
describe '#execute' do
|
|
|
|
let(:package_id) { maven_package.id }
|
|
|
|
|
|
|
|
subject { described_class.new(project, package_id).execute }
|
|
|
|
|
|
|
|
it { is_expected.to eq(maven_package) }
|
|
|
|
|
2021-05-11 11:10:20 -04:00
|
|
|
context 'with non-displayable package' do
|
|
|
|
before do
|
|
|
|
maven_package.update_column(:status, 1)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'raises an exception' do
|
|
|
|
expect { subject }.to raise_exception(ActiveRecord::RecordNotFound)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-07-10 11:09:07 -04:00
|
|
|
context 'processing packages' do
|
2021-05-17 11:10:15 -04:00
|
|
|
let_it_be(:nuget_package) { create(:nuget_package, :processing, project: project) }
|
2021-06-28 23:07:32 -04:00
|
|
|
|
2020-07-10 11:09:07 -04:00
|
|
|
let(:package_id) { nuget_package.id }
|
|
|
|
|
|
|
|
it 'are not returned' do
|
|
|
|
expect { subject }.to raise_exception(ActiveRecord::RecordNotFound)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|