diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-22 15:08:58 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-22 15:08:58 +0300 |
commit | ed45528885b7b44c61f18175fe7cdbda12360669 (patch) | |
tree | 3d27c00a8a83d569cf238eaa05b7eb24b7a28a8d /spec/controllers | |
parent | ab85af0f318ccbcfdd508e7a2f85788f26831785 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/projects/repositories_controller_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/controllers/projects/repositories_controller_spec.rb b/spec/controllers/projects/repositories_controller_spec.rb index d4a81f24d9c..2d39f0afaee 100644 --- a/spec/controllers/projects/repositories_controller_spec.rb +++ b/spec/controllers/projects/repositories_controller_spec.rb @@ -6,6 +6,10 @@ describe Projects::RepositoriesController do let(:project) { create(:project, :repository) } describe "GET archive" do + before do + allow(controller).to receive(:archive_rate_limit_reached?).and_return(false) + end + context 'as a guest' do it 'responds with redirect in correct format' do get :archive, params: { namespace_id: project.namespace, project_id: project, id: "master" }, format: "zip" @@ -96,6 +100,16 @@ describe Projects::RepositoriesController do end end + describe 'rate limiting' do + it 'rate limits user when thresholds hit' do + expect(controller).to receive(:archive_rate_limit_reached?).and_return(true) + + get :archive, params: { namespace_id: project.namespace, project_id: project, id: 'master' }, format: "html" + + expect(response).to have_gitlab_http_status(:too_many_requests) + end + end + describe 'caching' do it 'sets appropriate caching headers' do get_archive |