diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-04 19:51:40 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-12-04 19:51:40 +0300 |
commit | aefe6486cf0d193067112b90145083d73b96bfef (patch) | |
tree | 02dbf7d022069b183f34b63e99eb359d7e001ddb /spec/finders/projects_finder_spec.rb | |
parent | 66ebf02c05dc69a65731d61baf28ef3335db2bbf (diff) |
Add latest changes from gitlab-org/security/gitlab@13-6-stable-ee
Diffstat (limited to 'spec/finders/projects_finder_spec.rb')
-rw-r--r-- | spec/finders/projects_finder_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/finders/projects_finder_spec.rb b/spec/finders/projects_finder_spec.rb index 2d712bd44ce..57977fb69b4 100644 --- a/spec/finders/projects_finder_spec.rb +++ b/spec/finders/projects_finder_spec.rb @@ -161,6 +161,29 @@ RSpec.describe ProjectsFinder, :do_not_mock_admin_mode do it { is_expected.to eq([public_project]) } end + describe 'filter by search with minimum search length' do + context 'when search term is shorter than minimum length' do + let(:params) { { search: 'C', minimum_search_length: 3 } } + + it { is_expected.to be_empty } + end + + context 'when search term is longer than minimum length' do + let(:project) { create(:project, :public, group: group, name: 'test_project') } + let(:params) { { search: 'test', minimum_search_length: 3 } } + + it { is_expected.to eq([project]) } + end + + context 'when minimum length is invalid' do + let(:params) { { search: 'C', minimum_search_length: 'x' } } + + it 'ignores the minimum length param' do + is_expected.to eq([public_project]) + end + end + end + describe 'filter by group name' do let(:params) { { name: group.name, search_namespaces: true } } |