diff --git a/spec/rack_attack_spec.rb b/spec/rack_attack_spec.rb index 377ab852..54f2f1df 100644 --- a/spec/rack_attack_spec.rb +++ b/spec/rack_attack_spec.rb @@ -125,6 +125,19 @@ end end + if defined?(Redis) && defined?(ActiveSupport::Cache::RedisCacheStore) + it 'should delete rack attack keys' do + redis_cache_store = ActiveSupport::Cache::RedisCacheStore.new(namespace: 'ns') + redis_cache_store.write('key', 'value') + redis_cache_store.write("#{Rack::Attack.cache.prefix}::key", 'value') + Rack::Attack.cache.store = redis_cache_store + Rack::Attack.reset! + + _(redis_cache_store.read('key')).must_equal 'value' + _(redis_cache_store.read("#{Rack::Attack.cache.prefix}::key")).must_be_nil + end + end + if defined?(ActiveSupport::Cache::MemoryStore) it 'should delete rack attack keys' do memory_store = ActiveSupport::Cache::MemoryStore.new(namespace: 'ns')