diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-23 12:08:18 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-23 12:08:18 +0000 |
commit | 4aeb8a02c506eaa8f0710ee17edd9e35dd68d280 (patch) | |
tree | 42a0ab818ee72a5f99d017f7ca05b6b6349e142a /spec/support/shared_examples/requests | |
parent | b8bb2148c282f5ebaf5cd3c83d905285902a1446 (diff) | |
download | gitlab-ce-4aeb8a02c506eaa8f0710ee17edd9e35dd68d280.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support/shared_examples/requests')
-rw-r--r-- | spec/support/shared_examples/requests/api/diff_discussions.rb | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/spec/support/shared_examples/requests/api/diff_discussions.rb b/spec/support/shared_examples/requests/api/diff_discussions.rb index 76c6c93964a..a7774d17d3c 100644 --- a/spec/support/shared_examples/requests/api/diff_discussions.rb +++ b/spec/support/shared_examples/requests/api/diff_discussions.rb @@ -38,13 +38,24 @@ shared_examples 'diff discussions API' do |parent_type, noteable_type, id_name| expect(json_response['notes'].first['position']).to eq(position.stringify_keys) end - it "returns a 400 bad request error when position is invalid" do - position = diff_note.position.to_h.merge(new_line: '100000') + context "when position is invalid" do + it "returns a 400 bad request error when position is not plausible" do + position = diff_note.position.to_h.merge(new_line: '100000') - post api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/discussions", user), - params: { body: 'hi!', position: position } + post api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/discussions", user), + params: { body: 'hi!', position: position } + + expect(response).to have_gitlab_http_status(400) + end + + it "returns a 400 bad request error when the position is not valid for this discussion" do + position = diff_note.position.to_h.merge(new_line: '588440f66559714280628a4f9799f0c4eb880a4a') + + post api("/#{parent_type}/#{parent.id}/#{noteable_type}/#{noteable[id_name]}/discussions", user), + params: { body: 'hi!', position: position } - expect(response).to have_gitlab_http_status(400) + expect(response).to have_gitlab_http_status(400) + end end end |