diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 22:00:14 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-01-18 22:00:14 +0300 |
commit | 05f0ebba3a2c8ddf39e436f412dc2ab5bf1353b2 (patch) | |
tree | 11d0f2a6ec31c7793c184106cedc2ded3d9a2cc5 /spec/requests/api/search_spec.rb | |
parent | ec73467c23693d0db63a797d10194da9e72a74af (diff) |
Add latest changes from gitlab-org/gitlab@15-8-stable-eev15.8.0-rc42
Diffstat (limited to 'spec/requests/api/search_spec.rb')
-rw-r--r-- | spec/requests/api/search_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/requests/api/search_spec.rb b/spec/requests/api/search_spec.rb index 430d3b7d187..035f53db12e 100644 --- a/spec/requests/api/search_spec.rb +++ b/spec/requests/api/search_spec.rb @@ -377,6 +377,26 @@ RSpec.describe API::Search, feature_category: :global_search do end end + context 'global search is disabled for the given scope' do + it 'returns forbidden response' do + allow_next_instance_of(SearchService) do |instance| + allow(instance).to receive(:global_search_enabled_for_scope?).and_return false + end + get api(endpoint, user), params: { search: 'awesome', scope: 'issues' } + expect(response).to have_gitlab_http_status(:forbidden) + end + end + + context 'global search is enabled for the given scope' do + it 'returns forbidden response' do + allow_next_instance_of(SearchService) do |instance| + allow(instance).to receive(:global_search_enabled_for_scope?).and_return true + end + get api(endpoint, user), params: { search: 'awesome', scope: 'issues' } + expect(response).to have_gitlab_http_status(:ok) + end + end + it 'increments the custom search sli error rate with error false if no error occurred' do expect(Gitlab::Metrics::GlobalSearchSlis).to receive(:record_error_rate).with( error: false, |