Merge pull request #344 from grzuy/clear_configuration

Avoid user confusion by renaming .clear! to .clear_configuration
This commit is contained in:
Gonzalo Rodriguez 2018-05-21 09:58:03 -03:00 committed by GitHub
commit e312f006b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -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

View file

@ -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