Skip to content

Commit

Permalink
Merge pull request #266 from grzuy/test_understandability
Browse files Browse the repository at this point in the history
Attempt to make it easier to understand that the method is making assertions
  • Loading branch information
grzuy authored Mar 9, 2018
2 parents 42cd957 + ca73994 commit 8603a3e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion spec/rack_attack_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ def remote_ip
end
end

allow_ok_requests
it_allows_ok_requests
end
end
4 changes: 2 additions & 2 deletions spec/rack_attack_spec.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -44,7 +44,7 @@
last_request.env['rack.attack.match_type'].must_equal :blocklist
end

allow_ok_requests
it_allows_ok_requests
end

describe "and safelist" do
Expand Down
8 changes: 4 additions & 4 deletions spec/rack_attack_throttle_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

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' }
Expand Down Expand Up @@ -54,7 +54,7 @@
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' }
Expand All @@ -78,7 +78,7 @@
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' }
Expand All @@ -102,7 +102,7 @@
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' }
Expand Down
2 changes: 1 addition & 1 deletion spec/rack_attack_track_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def self.check
Rack::Attack.track("everything"){ |req| true }
end

allow_ok_requests
it_allows_ok_requests

it "should tag the env" do
get '/'
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def app
}.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
Expand Down

0 comments on commit 8603a3e

Please sign in to comment.