mirror of
https://github.com/samsonjs/rack-attack.git
synced 2026-03-25 09:25:49 +00:00
Fixes warning 'DEPRECATED: Use assert_nil if expecting nil from ...'
This commit is contained in:
parent
03ade2e056
commit
e8102910bf
3 changed files with 6 additions and 6 deletions
|
|
@ -73,7 +73,7 @@ describe 'Rack::Attack.Fail2Ban' do
|
|||
|
||||
it 'resets fail count' do
|
||||
key = "rack::attack:#{Time.now.to_i/@findtime}:fail2ban:count:1.2.3.4"
|
||||
@cache.store.read(key).must_equal nil
|
||||
assert_nil @cache.store.read(key)
|
||||
end
|
||||
|
||||
it 'IP is not banned' do
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ describe Rack::Attack::Cache do
|
|||
store.write(@key, "foobar", :expires_in => @expires_in)
|
||||
@cache.read('cache-test-key').must_equal "foobar"
|
||||
store.delete(@key)
|
||||
@cache.read('cache-test-key').must_equal nil
|
||||
assert_nil @cache.read('cache-test-key')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -113,7 +113,7 @@ describe Rack::Attack::Cache do
|
|||
period_key, _ = @cache.send(:key_and_expiry, 'cache-test-key', period)
|
||||
store.read(period_key).to_i.must_equal 1
|
||||
@cache.reset_count(unprefixed_key, period)
|
||||
store.read(period_key).must_equal nil
|
||||
assert_nil store.read(period_key)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -99,11 +99,11 @@ describe 'Rack::Attack.throttle with block retuning nil' do
|
|||
before { get '/', {}, 'REMOTE_ADDR' => '1.2.3.4' }
|
||||
it 'should not set the counter' do
|
||||
key = "rack::attack:#{Time.now.to_i/@period}:ip/sec:1.2.3.4"
|
||||
Rack::Attack.cache.store.read(key).must_equal nil
|
||||
assert_nil Rack::Attack.cache.store.read(key)
|
||||
end
|
||||
|
||||
it 'should not populate throttle data' do
|
||||
last_request.env['rack.attack.throttle_data'].must_equal nil
|
||||
assert_nil last_request.env['rack.attack.throttle_data']
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue