diff --git a/config/initializers/rspec_profiling.rb b/config/initializers/rspec_profiling.rb
index a7efd74f09e93d9afdb62f1604807e54d3611432..16b9d5b15e5fa7b5785c3c7a372875e96998b801 100644
--- a/config/initializers/rspec_profiling.rb
+++ b/config/initializers/rspec_profiling.rb
@@ -32,7 +32,7 @@ end
 
 if Rails.env.test?
   RspecProfiling.configure do |config|
-    if ENV['RSPEC_PROFILING_POSTGRES_URL']
+    if ENV['RSPEC_PROFILING_POSTGRES_URL'].present?
       RspecProfiling::Collectors::PSQL.prepend(RspecProfilingExt::PSQL)
       config.collector = RspecProfiling::Collectors::PSQL
     end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index e2d5928e5b2420962dd101421bf17ce4a9d4356a..a58f4e664b712c4ef47d062059075b8469069e22 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -10,7 +10,7 @@ require 'shoulda/matchers'
 require 'rspec/retry'
 
 rspec_profiling_is_configured =
-  ENV['RSPEC_PROFILING_POSTGRES_URL'] ||
+  ENV['RSPEC_PROFILING_POSTGRES_URL'].present? ||
   ENV['RSPEC_PROFILING']
 branch_can_be_profiled =
   ENV['GITLAB_DATABASE'] == 'postgresql' &&