diff options
author | Mark Fletcher <mark@gitlab.com> | 2017-12-20 01:00:17 +0300 |
---|---|---|
committer | Mark Fletcher <mark@gitlab.com> | 2017-12-20 10:23:57 +0300 |
commit | 055543b915c13df57e13629cd49ca9d63b6e3e76 (patch) | |
tree | 8cf6369d6f71f36d62f2a5b936494eaba49fb9f6 /spec | |
parent | c9732b3c6dc07b4ffd0df9c2ae88e1f67cd56243 (diff) |
Add optional `search` param for Merge Requests API
Diffstat (limited to 'spec')
-rw-r--r-- | spec/requests/api/merge_requests_spec.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/requests/api/merge_requests_spec.rb b/spec/requests/api/merge_requests_spec.rb index 91616da6d9a..60dbd74d59d 100644 --- a/spec/requests/api/merge_requests_spec.rb +++ b/spec/requests/api/merge_requests_spec.rb @@ -150,6 +150,26 @@ describe API::MergeRequests do expect(json_response.length).to eq(1) expect(json_response.first['id']).to eq(merge_request3.id) end + + context 'search params' do + before do + merge_request.update(title: 'Search title', description: 'Search description') + end + + it 'returns merge requests matching given search string for title' do + get api("/merge_requests", user), search: merge_request.title + + expect(json_response.length).to eq(1) + expect(json_response.first['id']).to eq(merge_request.id) + end + + it 'returns merge requests for project matching given search string for description' do + get api("/merge_requests", user), project_id: project.id, search: merge_request.description + + expect(json_response.length).to eq(1) + expect(json_response.first['id']).to eq(merge_request.id) + end + end end end |