Skip to content

Commit 4d55df1

Browse files
authored
Clarify that DATABASE_URL can not be empty if allowlist is used
1 parent 09b47d0 commit 4d55df1

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

README.markdown

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ DatabaseCleaner.allow_production = true
337337
DatabaseCleaner.allow_remote_database_url = true
338338
```
339339

340-
In Ruby, a URL allowlist can be specified. When specified, DatabaseCleaner will only allow `DATABASE_URL` to be equal
340+
In Ruby, a URL allowlist can be specified. When specified, DatabaseCleaner will require `DATABASE_URL` to be set and equal
341341
to one of the values specified in the url allowlist like so:
342342

343343
```ruby
@@ -348,8 +348,9 @@ Allowlist elements are matched with case equality (`===`), so regular expression
348348

349349
```ruby
350350
DatabaseCleaner.url_allowlist = [
351-
%r{^postgres://postgres@localhost}, # match any db with this prefix
352-
proc {|uri| URI.parse(uri).user == "test" } # match any db authenticating with the 'test' user
351+
%r{^postgres://postgres@localhost}, # match any db with this prefix
352+
proc {|uri| URI.parse(uri).user == "test" }, # match any db authenticating with the 'test' user
353+
nil # allow DATABASE_URL to be unset
353354
]
354355
```
355356

0 commit comments

Comments
 (0)