Merge branch '6-stable'

This commit is contained in:
Gonzalo Rodriguez 2020-04-26 13:09:29 -03:00
commit fe5deb9093
No known key found for this signature in database
GPG key ID: 5DB8B81B049B8AB1

View file

@ -37,6 +37,7 @@ See the [Backing & Hacking blog post](https://www.kickstarter.com/backing-and-ha
- [Customizing responses](#customizing-responses)
- [RateLimit headers for well-behaved clients](#ratelimit-headers-for-well-behaved-clients)
- [Logging & Instrumentation](#logging--instrumentation)
- [Testing](#testing)
- [How it works](#how-it-works)
- [About Tracks](#about-tracks)
- [Testing](#testing)
@ -393,6 +394,16 @@ ActiveSupport::Notifications.subscribe(/rack_attack/) do |name, start, finish, r
end
```
## Testing
### Disabling
`Rack::Attack.enabled = false` can be used to either completely disable Rack::Attack in your tests, or to disable/enable for specific test cases only.
### Test case isolation
`Rack::Attack.reset!` can be used in your test suite to clear any Rack::Attack state between different test cases.
## How it works
The Rack::Attack middleware compares each request against *safelists*, *blocklists*, *throttles*, and *tracks* that you define. There are none by default.