Use rack_attack_enabled?
We cannot enable rack attack during the tests as it interferes with features spec. So we add a flag to enable it during the runtime.
This commit is contained in:
parent
0f0fecdb25
commit
86d968bb8e
2 changed files with 29 additions and 22 deletions
|
@ -6,10 +6,15 @@ describe Rack::Attack, type: :request do
|
|||
let(:ip) { "1.2.3.4" }
|
||||
|
||||
before(:each) do
|
||||
ENV['RACK_ATTACK_ENABLE'] = 'true'
|
||||
setup_rack_attack_cache_store
|
||||
avoid_test_overlaps_in_cache
|
||||
end
|
||||
|
||||
after do
|
||||
ENV['RACK_ATTACK_ENABLE'] = 'false'
|
||||
end
|
||||
|
||||
def setup_rack_attack_cache_store
|
||||
Rack::Attack.cache.store = ActiveSupport::Cache::MemoryStore.new
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue