mirror of
https://github.com/samsonjs/rack-attack.git
synced 2026-03-25 09:25:49 +00:00
Merge pull request #266 from grzuy/test_understandability
Attempt to make it easier to understand that the method is making assertions
This commit is contained in:
commit
8603a3e056
5 changed files with 9 additions and 9 deletions
|
|
@ -14,6 +14,6 @@ describe 'Rack::Attack' do
|
|||
end
|
||||
end
|
||||
|
||||
allow_ok_requests
|
||||
it_allows_ok_requests
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
require_relative 'spec_helper'
|
||||
|
||||
describe 'Rack::Attack' do
|
||||
allow_ok_requests
|
||||
it_allows_ok_requests
|
||||
|
||||
describe 'normalizing paths' do
|
||||
before do
|
||||
|
|
@ -44,7 +44,7 @@ describe 'Rack::Attack' do
|
|||
last_request.env['rack.attack.match_type'].must_equal :blocklist
|
||||
end
|
||||
|
||||
allow_ok_requests
|
||||
it_allows_ok_requests
|
||||
end
|
||||
|
||||
describe "and safelist" do
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ describe 'Rack::Attack.throttle' do
|
|||
|
||||
it('should have a throttle') { Rack::Attack.throttles.key?('ip/sec') }
|
||||
|
||||
allow_ok_requests
|
||||
it_allows_ok_requests
|
||||
|
||||
describe 'a single request' do
|
||||
before { get '/', {}, 'REMOTE_ADDR' => '1.2.3.4' }
|
||||
|
|
@ -54,7 +54,7 @@ describe 'Rack::Attack.throttle with limit as proc' do
|
|||
Rack::Attack.throttle('ip/sec', :limit => lambda { |req| 1 }, :period => @period) { |req| req.ip }
|
||||
end
|
||||
|
||||
allow_ok_requests
|
||||
it_allows_ok_requests
|
||||
|
||||
describe 'a single request' do
|
||||
before { get '/', {}, 'REMOTE_ADDR' => '1.2.3.4' }
|
||||
|
|
@ -78,7 +78,7 @@ describe 'Rack::Attack.throttle with period as proc' do
|
|||
Rack::Attack.throttle('ip/sec', :limit => lambda { |req| 1 }, :period => lambda { |req| @period }) { |req| req.ip }
|
||||
end
|
||||
|
||||
allow_ok_requests
|
||||
it_allows_ok_requests
|
||||
|
||||
describe 'a single request' do
|
||||
before { get '/', {}, 'REMOTE_ADDR' => '1.2.3.4' }
|
||||
|
|
@ -102,7 +102,7 @@ describe 'Rack::Attack.throttle with block retuning nil' do
|
|||
Rack::Attack.throttle('ip/sec', :limit => 1, :period => @period) { |_| nil }
|
||||
end
|
||||
|
||||
allow_ok_requests
|
||||
it_allows_ok_requests
|
||||
|
||||
describe 'a single request' do
|
||||
before { get '/', {}, 'REMOTE_ADDR' => '1.2.3.4' }
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ describe 'Rack::Attack.track' do
|
|||
Rack::Attack.track("everything"){ |req| true }
|
||||
end
|
||||
|
||||
allow_ok_requests
|
||||
it_allows_ok_requests
|
||||
|
||||
it "should tag the env" do
|
||||
get '/'
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class MiniTest::Spec
|
|||
}.to_app
|
||||
end
|
||||
|
||||
def self.allow_ok_requests
|
||||
def self.it_allows_ok_requests
|
||||
it "must allow ok requests" do
|
||||
get '/', {}, 'REMOTE_ADDR' => '127.0.0.1'
|
||||
last_response.status.must_equal 200
|
||||
|
|
|
|||
Loading…
Reference in a new issue