Commit 6c5f46ac authored by Michael Kozono's avatar Michael Kozono Committed by Francisco Lopez

Prevent affecting other tests

parent 6ba13b41
...@@ -22,14 +22,14 @@ describe 'Rack Attack global throttles' do ...@@ -22,14 +22,14 @@ describe 'Rack Attack global throttles' do
let(:period_in_seconds) { 10000 } let(:period_in_seconds) { 10000 }
let(:period) { period_in_seconds.seconds } let(:period) { period_in_seconds.seconds }
before do # Make time-dependent tests deterministic
around do |example|
# Instead of test environment's :null_store # Instead of test environment's :null_store
Rack::Attack.cache.store = ActiveSupport::Cache::MemoryStore.new Rack::Attack.cache.store = ActiveSupport::Cache::MemoryStore.new
end
# Make time-dependent tests deterministic
around do |example|
Timecop.freeze { example.run } Timecop.freeze { example.run }
Rack::Attack.cache.store = Rails.cache
end end
# Requires let variables: # Requires let variables:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment