Skip to content

A platform for community discussion. Free, open, simple.

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

Joffrey JAFFEUX052029b09b13
diff --git a/spec/integration/rate_limiting_spec.rb b/spec/integration/rate_limiting_spec.rb
index cdda0a8a75b..24e903635ef 100644
--- a/spec/integration/rate_limiting_spec.rb
+++ b/spec/integration/rate_limiting_spec.rb
@@ -44,6 +44,8 @@ RSpec.describe "rate limiter integration" do
expect(response.cookies.has_key?(name)).to eq(true)
expect(response.cookies[name]).to be_nil
end
+
+ RateLimiter.clear_all!
end
it "can cleanly limit requests and sets a Retry-After header" do
diff --git a/spec/requests/slugs_controller_spec.rb b/spec/requests/slugs_controller_spec.rb
index 8eea9fa72fa..ddd21552624 100644
--- a/spec/requests/slugs_controller_spec.rb
+++ b/spec/requests/slugs_controller_spec.rb
@@ -24,6 +24,7 @@ RSpec.describe SlugsController do
it "rate limits" do
RateLimiter.enable
+ RateLimiter.clear_all!
stub_const(SlugsController, "MAX_SLUG_GENERATIONS_PER_MINUTE", 1) do
post "/slugs.json?name=#{name}"