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

rack_attack_shared_context.rb « shared_contexts « support « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e7b2ee76c3c9fb02a35fc822d18e2f7ba0b53f88 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
# frozen_string_literal: true

RSpec.shared_context 'rack attack cache store' do
  around do |example|
    # Instead of test environment's :null_store so the throttles can increment
    Rack::Attack.cache.store = ActiveSupport::Cache::MemoryStore.new

    # Make time-dependent tests deterministic
    Timecop.freeze { example.run }

    Rack::Attack.cache.store = Rails.cache
  end
end