diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-15 15:42:17 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-15 15:42:17 +0000 |
commit | 44fdf983bd35328dd577d3d3650d14163ef3e2b6 (patch) | |
tree | 84ff300d056cfbabb5a0fe2a9cbaa80aaeab1cc5 /spec/requests | |
parent | bc9fa07b26184b5c94808f704db6ea1ac81bf4de (diff) | |
download | gitlab-ce-44fdf983bd35328dd577d3d3650d14163ef3e2b6.tar.gz |
Add latest changes from gitlab-org/gitlab@12-10-stable-ee
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/issues/post_projects_issues_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/requests/api/issues/post_projects_issues_spec.rb b/spec/requests/api/issues/post_projects_issues_spec.rb index be48113c215..1444f43003f 100644 --- a/spec/requests/api/issues/post_projects_issues_spec.rb +++ b/spec/requests/api/issues/post_projects_issues_spec.rb @@ -381,6 +381,20 @@ describe API::Issues do end.not_to change { project.labels.count } end end + + context 'when request exceeds the rate limit' do + before do + allow(::Gitlab::ApplicationRateLimiter).to receive(:throttled?).and_return(true) + end + + it 'prevents users from creating more issues' do + post api("/projects/#{project.id}/issues", user), + params: { title: 'new issue', labels: 'label, label2', weight: 3, assignee_ids: [user2.id] } + + expect(response).to have_gitlab_http_status(:too_many_requests) + expect(json_response['message']['error']).to eq('This endpoint has been requested too many times. Try again later.') + end + end end describe 'POST /projects/:id/issues with spam filtering' do |