diff --git a/README.markdown b/README.markdown index 2d933fa..290566e 100644 --- a/README.markdown +++ b/README.markdown @@ -349,6 +349,12 @@ to one of the values specified in the url allowlist like so: DatabaseCleaner.url_allowlist = ['postgres://postgres@localhost', 'postgres://foo@bar'] ``` +Allowlist elements may be specified as regular expressions if extra flexibility is required:: + +```ruby +DatabaseCleaner.url_allowlist = [%r{^postgres://postgres@localhost}] +``` + ## COPYRIGHT See [LICENSE](LICENSE) for details. diff --git a/spec/database_cleaner/safeguard_spec.rb b/spec/database_cleaner/safeguard_spec.rb index 3a24721..20b7993 100644 --- a/spec/database_cleaner/safeguard_spec.rb +++ b/spec/database_cleaner/safeguard_spec.rb @@ -86,7 +86,7 @@ module DatabaseCleaner describe 'A remote url is not on the allowlist' do let(:database_url) { 'postgress://bar.baz' } - it 'raises a allowlist error' do + it 'raises a not allowed error' do expect { cleaner.start }.to raise_error(Safeguard::Error::UrlNotAllowed) end end @@ -94,7 +94,7 @@ module DatabaseCleaner describe 'A similar url not explicitly matched as a pattern' do let(:database_url) { 'postgres://foo.bar?pool=8' } - it 'raises an allowlist error' do + it 'raises a not allowed error' do expect { cleaner.start }.to raise_error(Safeguard::Error::UrlNotAllowed) end end