From 218a320a3ddc508487071dfe45f18a1780976241 Mon Sep 17 00:00:00 2001 From: Gonzalo Rodriguez Date: Tue, 23 Jan 2018 16:54:13 -0300 Subject: [PATCH] Fixes warning instead of hiding it Warning was: 'warning: instance variable @data not initialized' --- Rakefile | 1 - lib/rack/attack/store_proxy.rb | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 5f7e9e0..300ec21 100644 --- a/Rakefile +++ b/Rakefile @@ -10,7 +10,6 @@ namespace :test do Rake::TestTask.new(:integration) do |t| t.pattern = "spec/integration/*_spec.rb" - t.warning = false end end diff --git a/lib/rack/attack/store_proxy.rb b/lib/rack/attack/store_proxy.rb index 4d69853..de0bc0c 100644 --- a/lib/rack/attack/store_proxy.rb +++ b/lib/rack/attack/store_proxy.rb @@ -20,7 +20,10 @@ module Rack # We also want to use the underlying Dalli client instead of ::ActiveSupport::Cache::MemCacheStore, # and the MemCache client if using Rails 3.x - client = store.instance_variable_get(:@data) + if store.instance_variable_defined?(:@data) + client = store.instance_variable_get(:@data) + end + if ACTIVE_SUPPORT_WRAPPER_CLASSES.include?(store.class.to_s) && ACTIVE_SUPPORT_CLIENTS.include?(client.class.to_s) client else