From a25ae50bc1062baf0729f5926d2dd74e117c8bd8 Mon Sep 17 00:00:00 2001 From: Brian P O'Rourke Date: Tue, 30 Jun 2020 12:15:57 -0700 Subject: [PATCH] Docs and spec cleanup --- README.markdown | 6 ++++++ spec/database_cleaner/safeguard_spec.rb | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) 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