diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-01 21:13:05 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-01 21:13:05 +0000 |
commit | 58acbd41a1ee5aa51777f2ef88ce03bd698530c7 (patch) | |
tree | 3dc36a5296cf53123f494a49892cbb8267d31907 /spec/requests/api/search_spec.rb | |
parent | ad1e76fb4d1392c890c8b5e218a256a416d5a50b (diff) | |
download | gitlab-ce-58acbd41a1ee5aa51777f2ef88ce03bd698530c7.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/requests/api/search_spec.rb')
-rw-r--r-- | spec/requests/api/search_spec.rb | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/spec/requests/api/search_spec.rb b/spec/requests/api/search_spec.rb index 035f53db12e..eb0f3b3eaee 100644 --- a/spec/requests/api/search_spec.rb +++ b/spec/requests/api/search_spec.rb @@ -174,6 +174,23 @@ RSpec.describe API::Search, feature_category: :global_search do end end + context 'when there is a search error' do + let(:results) { instance_double('Gitlab::SearchResults', failed?: true, error: 'failed to parse query') } + + before do + allow_next_instance_of(SearchService) do |service| + allow(service).to receive(:search_objects).and_return([]) + allow(service).to receive(:search_results).and_return(results) + end + end + + it 'returns 400 error' do + get api(endpoint, user), params: { scope: 'issues', search: 'expected to fail' } + + expect(response).to have_gitlab_http_status(:bad_request) + end + end + context 'with correct params' do context 'for projects scope' do before do |