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

project_import_rate_limiter_shared_examples.rb « controllers « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 66d753a401062d2b66a2342fdac57fa10604e78e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

RSpec.shared_examples 'project import rate limiter' do
  let(:user) { create(:user) }

  before do
    sign_in(user)
  end

  context 'when limit exceeds' do
    before do
      allow(Gitlab::ApplicationRateLimiter).to receive(:throttled?).and_return(true)
    end

    it 'notifies and redirects user' do
      post :create, params: {}

      expect(flash[:alert]).to eq('This endpoint has been requested too many times. Try again later.')
      expect(response).to have_gitlab_http_status(:found)
    end
  end
end