diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-04 15:17:18 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-04 15:17:18 +0300 |
commit | fb5d3cceb8d43f8c2dc22a5d8c74327e9397f2e8 (patch) | |
tree | dbd3a17217fa46cf279ed692b605e03222fca360 /spec/finders | |
parent | 6cd4578a23ffe0fb94632f83a07a25d01f8d6821 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/finders')
-rw-r--r-- | spec/finders/packages/conan/package_finder_spec.rb | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/spec/finders/packages/conan/package_finder_spec.rb b/spec/finders/packages/conan/package_finder_spec.rb index f25a62225a8..787cb256486 100644 --- a/spec/finders/packages/conan/package_finder_spec.rb +++ b/spec/finders/packages/conan/package_finder_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true require 'spec_helper' -RSpec.describe ::Packages::Conan::PackageFinder do +RSpec.describe ::Packages::Conan::PackageFinder, feature_category: :package_registry do using RSpec::Parameterized::TableSyntax let_it_be_with_reload(:project) { create(:project) } @@ -15,7 +15,8 @@ RSpec.describe ::Packages::Conan::PackageFinder do describe '#execute' do let(:query) { "#{conan_package.name.split('/').first[0, 3]}%" } - let(:finder) { described_class.new(user, query: query) } + let(:finder) { described_class.new(user, params) } + let(:params) { { query: query } } subject { finder.execute } @@ -40,7 +41,7 @@ RSpec.describe ::Packages::Conan::PackageFinder do end with_them do - let(:expected_packages) { packages_visible ? [conan_package, conan_package2] : [] } + let(:expected_packages) { packages_visible ? [conan_package2, conan_package] : [] } let(:user) { role == :anonymous ? nil : super() } before do @@ -50,5 +51,23 @@ RSpec.describe ::Packages::Conan::PackageFinder do it { is_expected.to eq(expected_packages) } end + + context 'with project' do + subject { described_class.new(user, params, project: project).execute } + + it { is_expected.to match_array([conan_package2, conan_package]) } + + it 'respects the limit' do + stub_const("#{described_class}::MAX_PACKAGES_COUNT", 1) + + expect(subject).to match_array([conan_package2]) + end + + context 'with a different project' do + let_it_be(:project) { private_project } + + it { is_expected.to match_array([private_package]) } + end + end end end |