Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-10-13 06:12:30 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-10-13 06:12:30 +0300
commit4ae83df07e37b502c3b2fdbd352328d72f31d1f5 (patch)
treefcb9fef05b1f7cbe21220ba699225c5d16f8a458 /spec/controllers/projects
parent7f8df3432369ffa9a34c9a2831cad0ca9ca5ed4f (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers/projects')
-rw-r--r--spec/controllers/projects/issues_controller_spec.rb61
1 files changed, 32 insertions, 29 deletions
diff --git a/spec/controllers/projects/issues_controller_spec.rb b/spec/controllers/projects/issues_controller_spec.rb
index 977879b453c..0b3bd4d78ac 100644
--- a/spec/controllers/projects/issues_controller_spec.rb
+++ b/spec/controllers/projects/issues_controller_spec.rb
@@ -1411,39 +1411,42 @@ RSpec.describe Projects::IssuesController do
stub_application_setting(issues_create_limit: 5)
end
- it 'prevents from creating more issues', :request_store do
- 5.times { post_new_issue }
-
- expect { post_new_issue }
- .to change { Gitlab::GitalyClient.get_request_count }.by(1) # creates 1 projects and 0 issues
-
- post_new_issue
- expect(response.body).to eq(_('This endpoint has been requested too many times. Try again later.'))
- expect(response).to have_gitlab_http_status(:too_many_requests)
- end
-
- it 'logs the event on auth.log' do
- attributes = {
- message: 'Application_Rate_Limiter_Request',
- env: :issues_create_request_limit,
- remote_ip: '0.0.0.0',
- request_method: 'POST',
- path: "/#{project.full_path}/-/issues",
- user_id: user.id,
- username: user.username
- }
+ context 'when issue creation limits imposed' do
+ it 'prevents from creating more issues', :request_store do
+ 5.times { post_new_issue }
- expect(Gitlab::AuthLogger).to receive(:error).with(attributes).once
+ expect { post_new_issue }
+ .to change { Gitlab::GitalyClient.get_request_count }.by(1) # creates 1 projects and 0 issues
- project.add_developer(user)
- sign_in(user)
+ post_new_issue
- 6.times do
- post :create, params: {
- namespace_id: project.namespace.to_param,
- project_id: project,
- issue: { title: 'Title', description: 'Description' }
+ expect(response.body).to eq(_('This endpoint has been requested too many times. Try again later.'))
+ expect(response).to have_gitlab_http_status(:too_many_requests)
+ end
+
+ it 'logs the event on auth.log' do
+ attributes = {
+ message: 'Application_Rate_Limiter_Request',
+ env: :issues_create_request_limit,
+ remote_ip: '0.0.0.0',
+ request_method: 'POST',
+ path: "/#{project.full_path}/-/issues",
+ user_id: user.id,
+ username: user.username
}
+
+ expect(Gitlab::AuthLogger).to receive(:error).with(attributes).once
+
+ project.add_developer(user)
+ sign_in(user)
+
+ 6.times do
+ post :create, params: {
+ namespace_id: project.namespace.to_param,
+ project_id: project,
+ issue: { title: 'Title', description: 'Description' }
+ }
+ end
end
end
end