Commit a076f26c authored by Nick Kipling's avatar Nick Kipling

Add has_version check to package finders

Updated project and group finders
Updated tests for each
parent b67ee058
......@@ -22,6 +22,7 @@ module Packages
packages = ::Packages::Package
.for_projects(group_projects_visible_to_current_user)
.processed
.has_version
.sort_by_attribute("#{params[:order_by]}_#{params[:sort]}")
return packages unless package_type
......
......@@ -13,7 +13,7 @@ module Packages
end
def execute
packages = project.packages.processed
packages = project.packages.processed.has_version
packages = filter_by_package_type(packages)
packages = filter_by_package_name(packages)
packages = order_packages(packages)
......
......@@ -52,6 +52,12 @@ describe Packages::GroupPackagesFinder do
it { is_expected.to match_array([package1, package2]) }
end
context 'does not include packages without version number' do
let!(:package_without_version) { create(:maven_package, project: project, version: nil) }
it { is_expected.not_to include(package_without_version) }
end
end
context 'group has package of all types' do
......
......@@ -80,5 +80,11 @@ describe ::Packages::PackagesFinder do
it { is_expected.to match_array([conan_package, maven_package]) }
end
context 'does not include packages without version number' do
let_it_be(:package_without_version) { create(:maven_package, project: project, version: nil) }
it { is_expected.not_to include(package_without_version) }
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment