Stabilize rate limiter tests by using dependency injection

This commit is contained in:
Claudio Ortolina
2026-03-16 11:21:24 +00:00
parent 4a2b7f4e03
commit 028f111300
5 changed files with 141 additions and 67 deletions
+10
View File
@@ -0,0 +1,10 @@
defmodule Req.RateLimiter.Clock do
@moduledoc """
Behaviour for time operations used by `Req.RateLimiter`.
Allows injecting a fake clock in tests for deterministic throttle assertions.
"""
@callback now() :: integer()
@callback sleep(non_neg_integer()) :: :ok
end