class DatabaseCleaner::Safeguard::AllowedUrl

Public Instance Methods

run() click to toggle source
# File lib/database_cleaner/safeguard.rb, line 24
def run
  return if skip?
  raise Error::UrlNotAllowed if database_url_not_allowed?
end

Private Instance Methods

database_url_not_allowed?() click to toggle source
# File lib/database_cleaner/safeguard.rb, line 31
def database_url_not_allowed?
  !DatabaseCleaner.url_allowlist.any? {|allowed| allowed === ENV['DATABASE_URL'] }
end
skip?() click to toggle source
# File lib/database_cleaner/safeguard.rb, line 35
def skip?
  !DatabaseCleaner.url_allowlist
end