Skip to content

Instantly share code, notes, and snippets.

@njwest
Last active July 20, 2024 20:02
Show Gist options
  • Save njwest/5a74aee8846873608b4dbda826e952cf to your computer and use it in GitHub Desktop.
Save njwest/5a74aee8846873608b4dbda826e952cf to your computer and use it in GitHub Desktop.
# ...code omitted
import ExUnit.CaptureLog
# ...code omitted
test "allow_login_attempt?/2 returns false with a warning log when over the login attempt limit" do
assert RateLimiter.allow_login_attempt?(@test_email, @limit) == true
assert RateLimiter.allow_login_attempt?(@test_email, @limit) == true
log = capture_log(fn ->
assert RateLimiter.allow_login_attempt?(@test_email, @limit) == false
end)
assert log =~ "Login attempt limit exceeded for email: #{@test_email}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment