From 4d55df1fbc048542f5566d4f999c87be2c8cd04c Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Mon, 1 Jun 2026 23:02:02 +0300 Subject: [PATCH] Clarify that DATABASE_URL can not be empty if allowlist is used --- README.markdown | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.markdown b/README.markdown index 7aa2aded..abfe4c87 100644 --- a/README.markdown +++ b/README.markdown @@ -337,7 +337,7 @@ DatabaseCleaner.allow_production = true DatabaseCleaner.allow_remote_database_url = true ``` -In Ruby, a URL allowlist can be specified. When specified, DatabaseCleaner will only allow `DATABASE_URL` to be equal +In Ruby, a URL allowlist can be specified. When specified, DatabaseCleaner will require `DATABASE_URL` to be set and equal to one of the values specified in the url allowlist like so: ```ruby @@ -348,8 +348,9 @@ Allowlist elements are matched with case equality (`===`), so regular expression ```ruby DatabaseCleaner.url_allowlist = [ - %r{^postgres://postgres@localhost}, # match any db with this prefix - proc {|uri| URI.parse(uri).user == "test" } # match any db authenticating with the 'test' user + %r{^postgres://postgres@localhost}, # match any db with this prefix + proc {|uri| URI.parse(uri).user == "test" }, # match any db authenticating with the 'test' user + nil # allow DATABASE_URL to be unset ] ```