diff --git a/lib/rack/attack.rb b/lib/rack/attack.rb index c7596ef..8334dc6 100644 --- a/lib/rack/attack.rb +++ b/lib/rack/attack.rb @@ -120,12 +120,17 @@ class Rack::Attack @cache ||= Cache.new end - def clear! + def clear_configuration @safelists, @blocklists, @throttles, @tracks = {}, {}, {}, {} @ip_blocklists = [] @ip_safelists = [] end + def clear! + warn "[DEPRECATION] Rack::Attack.clear! is deprecated. Please use Rack::Attack.clear_configuration instead" + clear_configuration + end + def blacklisted_response=(res) warn "[DEPRECATION] 'Rack::Attack.blacklisted_response=' is deprecated. Please use 'blocklisted_response=' instead." self.blocklisted_response = res diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 8f8a71d..3f19b8f 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -28,7 +28,7 @@ class MiniTest::Spec end after do - Rack::Attack.clear! + Rack::Attack.clear_configuration Rack::Attack.instance_variable_set(:@cache, nil) Rack::Attack.throttled_response = @_original_throttled_response