diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-08 00:10:18 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-01-08 00:10:18 +0300 |
commit | fd320d0858df108b47ebadaa546a3c99f0e44cf1 (patch) | |
tree | 10fd76baeaf079ba50392d569c52d3d711169c8b /spec/support | |
parent | dec7332357ae21be289ac26a4c440cb0b5fa1002 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/helpers/rack_attack_spec_helpers.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/spec/support/helpers/rack_attack_spec_helpers.rb b/spec/support/helpers/rack_attack_spec_helpers.rb index 0f17b5b9137..95d74eb7923 100644 --- a/spec/support/helpers/rack_attack_spec_helpers.rb +++ b/spec/support/helpers/rack_attack_spec_helpers.rb @@ -30,7 +30,19 @@ module RackAttackSpecHelpers yield expect(response).to have_gitlab_http_status(:too_many_requests) - expect(response).to have_header('Retry-After') + + expect(response.headers.to_h).to include( + 'RateLimit-Limit' => a_string_matching(/^\d+$/), + 'RateLimit-Name' => a_string_matching(/^throttle_.*$/), + 'RateLimit-Observed' => a_string_matching(/^\d+$/), + 'RateLimit-Remaining' => a_string_matching(/^\d+$/), + 'RateLimit-Reset' => a_string_matching(/^\d+$/), + 'Retry-After' => a_string_matching(/^\d+$/) + ) + expect(response).to have_header('RateLimit-ResetTime') + expect do + Time.httpdate(response.headers['RateLimit-ResetTime']) + end.not_to raise_error end def expect_ok(&block) |