summaryrefslogtreecommitdiff
path: root/spec/support/shared_contexts/rack_attack_shared_context.rb
blob: 4e8c6e9dec6ba95aadf613bad4c6bd52ec416edd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
# 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

    example.run

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