DEV: fix a flakey spec in slugs_controller (#20350)

This commit is contained in:
Joffrey JAFFEUX 2023-02-17 18:56:25 +01:00 committed by GitHub
parent a945ca3e01
commit 052029b09b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View File

@ -44,6 +44,8 @@ RSpec.describe "rate limiter integration" do
expect(response.cookies.has_key?(name)).to eq(true) expect(response.cookies.has_key?(name)).to eq(true)
expect(response.cookies[name]).to be_nil expect(response.cookies[name]).to be_nil
end end
RateLimiter.clear_all!
end end
it "can cleanly limit requests and sets a Retry-After header" do it "can cleanly limit requests and sets a Retry-After header" do

View File

@ -24,6 +24,7 @@ RSpec.describe SlugsController do
it "rate limits" do it "rate limits" do
RateLimiter.enable RateLimiter.enable
RateLimiter.clear_all!
stub_const(SlugsController, "MAX_SLUG_GENERATIONS_PER_MINUTE", 1) do stub_const(SlugsController, "MAX_SLUG_GENERATIONS_PER_MINUTE", 1) do
post "/slugs.json?name=#{name}" post "/slugs.json?name=#{name}"