mirror of
https://github.com/DatabaseCleaner/database_cleaner
synced 2023-03-27 23:22:03 -04:00
consider all sqlite DATABASE_URLs local.
This commit is contained in:
parent
8e34c1e652
commit
7519d43810
2 changed files with 9 additions and 1 deletions
|
@ -15,7 +15,7 @@ module DatabaseCleaner
|
||||||
end
|
end
|
||||||
|
|
||||||
class RemoteDatabaseUrl
|
class RemoteDatabaseUrl
|
||||||
LOCAL = %w(localhost 127.0.0.1)
|
LOCAL = %w(localhost 127.0.0.1 sqlite3:)
|
||||||
|
|
||||||
def run
|
def run
|
||||||
raise Error::RemoteDatabaseUrl if !skip? && given?
|
raise Error::RemoteDatabaseUrl if !skip? && given?
|
||||||
|
|
|
@ -36,6 +36,14 @@ module DatabaseCleaner
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe 'to a sqlite db' do
|
||||||
|
let(:database_url) { 'sqlite3:tmp/db.sqlite3' }
|
||||||
|
|
||||||
|
it 'does not raise' do
|
||||||
|
expect { cleaner.start }.to_not raise_error
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe 'DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL is set' do
|
describe 'DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL is set' do
|
||||||
let(:database_url) { 'postgres://remote.host' }
|
let(:database_url) { 'postgres://remote.host' }
|
||||||
before { stub_const('ENV', 'DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL' => true) }
|
before { stub_const('ENV', 'DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL' => true) }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue