diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index <HASH>..<HASH> 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -30,11 +30,13 @@ Dir[root.join('shared/*.rb').to_s].each do |f|
   require f
 end
 
-DB_URI = if defined? JRUBY_VERSION
-           'jdbc:postgresql://localhost/rom_factory'
-         else
-           'postgres://localhost/rom_factory'
-         end
+DB_URI = ENV.fetch('DATABASE_URL') do
+  if defined? JRUBY_VERSION
+    'jdbc:postgresql://localhost/rom_factory'
+  else
+    'postgres://localhost/rom_factory'
+  end
+end
 
 warning_api_available = RUBY_VERSION >= '2.4.0'
Allow DATABASE_URL from env