mirror of
https://github.com/samsonjs/rack-attack.git
synced 2026-04-27 15:07:41 +00:00
Avoid user confusion by renaming .clear! to .clear_configuration
This commit is contained in:
parent
cf672d60c1
commit
a99722bf4b
2 changed files with 7 additions and 2 deletions
|
|
@ -120,12 +120,17 @@ class Rack::Attack
|
||||||
@cache ||= Cache.new
|
@cache ||= Cache.new
|
||||||
end
|
end
|
||||||
|
|
||||||
def clear!
|
def clear_configuration
|
||||||
@safelists, @blocklists, @throttles, @tracks = {}, {}, {}, {}
|
@safelists, @blocklists, @throttles, @tracks = {}, {}, {}, {}
|
||||||
@ip_blocklists = []
|
@ip_blocklists = []
|
||||||
@ip_safelists = []
|
@ip_safelists = []
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def clear!
|
||||||
|
warn "[DEPRECATION] Rack::Attack.clear! is deprecated. Please use Rack::Attack.clear_configuration instead"
|
||||||
|
clear_configuration
|
||||||
|
end
|
||||||
|
|
||||||
def blacklisted_response=(res)
|
def blacklisted_response=(res)
|
||||||
warn "[DEPRECATION] 'Rack::Attack.blacklisted_response=' is deprecated. Please use 'blocklisted_response=' instead."
|
warn "[DEPRECATION] 'Rack::Attack.blacklisted_response=' is deprecated. Please use 'blocklisted_response=' instead."
|
||||||
self.blocklisted_response = res
|
self.blocklisted_response = res
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ class MiniTest::Spec
|
||||||
end
|
end
|
||||||
|
|
||||||
after do
|
after do
|
||||||
Rack::Attack.clear!
|
Rack::Attack.clear_configuration
|
||||||
Rack::Attack.instance_variable_set(:@cache, nil)
|
Rack::Attack.instance_variable_set(:@cache, nil)
|
||||||
|
|
||||||
Rack::Attack.throttled_response = @_original_throttled_response
|
Rack::Attack.throttled_response = @_original_throttled_response
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue