summaryrefslogtreecommitdiff
path: root/spec/requests
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2018-06-20 09:20:27 +0000
committerSean McGivern <sean@mcgivern.me.uk>2018-06-20 09:20:27 +0000
commit329b00672d014994e7189b24a7c2e65771363152 (patch)
treed06ac18fac08ece8c2973a3402e99d2f9b2bb6ee /spec/requests
parentb60415c2b7deb2dfc8147445bee52022c128d416 (diff)
parent7357209f91ae4c0b504f47e36220bd04a0e2feca (diff)
downloadgitlab-ce-329b00672d014994e7189b24a7c2e65771363152.tar.gz
Merge branch 'ce-5024-filename-search' into 'master'
Implement filtering by filename on code search Closes #43627 See merge request gitlab-org/gitlab-ce!19509
Diffstat (limited to 'spec/requests')
-rw-r--r--spec/requests/api/search_spec.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/spec/requests/api/search_spec.rb b/spec/requests/api/search_spec.rb
index aca4aa40027..f8e468be170 100644
--- a/spec/requests/api/search_spec.rb
+++ b/spec/requests/api/search_spec.rb
@@ -312,6 +312,30 @@ describe API::Search do
end
it_behaves_like 'response is correct', schema: 'public_api/v4/blobs', size: 2
+
+ context 'filters' do
+ it 'by filename' do
+ get api("/projects/#{repo_project.id}/search", user), scope: 'blobs', search: 'mon filename:PROCESS.md'
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response.size).to eq(2)
+ expect(json_response.first['filename']).to eq('PROCESS.md')
+ end
+
+ it 'by path' do
+ get api("/projects/#{repo_project.id}/search", user), scope: 'blobs', search: 'mon path:markdown'
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response.size).to eq(8)
+ end
+
+ it 'by extension' do
+ get api("/projects/#{repo_project.id}/search", user), scope: 'blobs', search: 'mon extension:md'
+
+ expect(response).to have_gitlab_http_status(200)
+ expect(json_response.size).to eq(11)
+ end
+ end
end
end
end