From e8102910bff143be269d9a6707068a9e5b357370 Mon Sep 17 00:00:00 2001 From: Gonzalo Rodriguez Date: Tue, 23 Jan 2018 15:07:24 -0300 Subject: [PATCH] Fixes warning 'DEPRECATED: Use assert_nil if expecting nil from ...' --- spec/fail2ban_spec.rb | 2 +- spec/integration/rack_attack_cache_spec.rb | 4 ++-- spec/rack_attack_throttle_spec.rb | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/fail2ban_spec.rb b/spec/fail2ban_spec.rb index 0f24524..adbdb0e 100644 --- a/spec/fail2ban_spec.rb +++ b/spec/fail2ban_spec.rb @@ -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 diff --git a/spec/integration/rack_attack_cache_spec.rb b/spec/integration/rack_attack_cache_spec.rb index 6eb27ef..d2001ea 100644 --- a/spec/integration/rack_attack_cache_spec.rb +++ b/spec/integration/rack_attack_cache_spec.rb @@ -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 diff --git a/spec/rack_attack_throttle_spec.rb b/spec/rack_attack_throttle_spec.rb index d64a27d..394102e 100644 --- a/spec/rack_attack_throttle_spec.rb +++ b/spec/rack_attack_throttle_spec.rb @@ -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 \ No newline at end of file +end