diff --git a/lib/rack/attack/allow2ban.rb b/lib/rack/attack/allow2ban.rb index 7feb91a..f5772c8 100644 --- a/lib/rack/attack/allow2ban.rb +++ b/lib/rack/attack/allow2ban.rb @@ -13,10 +13,9 @@ module Rack count = cache.count("#{key_prefix}:count:#{discriminator}", findtime) if count >= maxretry ban!(discriminator, bantime) - true - else - false end + # we may not block them this time, but they're banned for next time + false end end end diff --git a/spec/allow2ban_spec.rb b/spec/allow2ban_spec.rb index 14c7648..569c213 100644 --- a/spec/allow2ban_spec.rb +++ b/spec/allow2ban_spec.rb @@ -45,8 +45,8 @@ describe 'Rack::Attack.Allow2Ban' do get '/?foo=OMGHAX', {}, 'REMOTE_ADDR' => '1.2.3.4' end - it 'fails' do - last_response.status.must_equal 401 + it 'succeeds' do + last_response.status.must_equal 200 end it 'increases fail count' do