diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 16:49:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-02-20 16:49:51 +0300 |
commit | 71786ddc8e28fbd3cb3fcc4b3ff15e5962a1c82e (patch) | |
tree | 6a2d93ef3fb2d353bb7739e4b57e6541f51cdd71 /spec/controllers/import/bulk_imports_controller_spec.rb | |
parent | a7253423e3403b8c08f8a161e5937e1488f5f407 (diff) |
Add latest changes from gitlab-org/gitlab@15-9-stable-eev15.9.0-rc42
Diffstat (limited to 'spec/controllers/import/bulk_imports_controller_spec.rb')
-rw-r--r-- | spec/controllers/import/bulk_imports_controller_spec.rb | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/spec/controllers/import/bulk_imports_controller_spec.rb b/spec/controllers/import/bulk_imports_controller_spec.rb index a0d5b576e74..a3992ae850e 100644 --- a/spec/controllers/import/bulk_imports_controller_spec.rb +++ b/spec/controllers/import/bulk_imports_controller_spec.rb @@ -9,14 +9,12 @@ RSpec.describe Import::BulkImportsController, feature_category: :importers do stub_application_setting(bulk_import_enabled: true) sign_in(user) + + allow(::Gitlab::ApplicationRateLimiter).to receive(:throttled?).and_return(false) end context 'when user is signed in' do context 'when bulk_import feature flag is enabled' do - before do - stub_feature_flags(bulk_import: true) - end - describe 'POST configure' do before do allow_next_instance_of(BulkImports::Clients::HTTP) do |instance| @@ -400,6 +398,18 @@ RSpec.describe Import::BulkImportsController, feature_category: :importers do expect(response).to have_gitlab_http_status(:unprocessable_entity) end end + + context 'when request exceeds rate limits' do + it 'prevents user from starting a new migration' do + allow(::Gitlab::ApplicationRateLimiter).to receive(:throttled?).and_return(true) + + post :create, params: { bulk_import: {} } + + request + + expect(response).to have_gitlab_http_status(:too_many_requests) + end + end end end |