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

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

require 'spec_helper'

RSpec.describe "Warden", feature_category: :system_access do
  describe "rate limit" do
    include_context 'unique ips sign in limit'
    let(:user) { create(:user) }

    before do
      # Set the rate limit to 1 request per IP address per user.
      stub_application_setting(unique_ips_limit_per_user: 1)
      sign_in(user)
    end

    it 'limits the number of requests that can be made from a single IP address per user' do
      change_ip('ip1')
      get user_path(user)
      expect(response).to be_successful

      change_ip('ip2')
      get user_path(user)
      expect(response).to be_forbidden
    end
  end
end