summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2017-04-13 23:10:55 +0000
committerRobert Speicher <robert@gitlab.com>2017-04-13 23:10:55 +0000
commit0e15e432adfd74576977c8abd5cf5cdffc02102a (patch)
tree2ff6e12a62b3cc724c31432798c4d8fb1ebb97bf
parent366f35ca6d4d65a2838842cf59e4744543c7d59f (diff)
parentd6550d255c62f736eaacb7f30133c0932bed644d (diff)
downloadgitlab-ce-0e15e432adfd74576977c8abd5cf5cdffc02102a.tar.gz
Merge branch '30907-allow-to-enable-rspec-profile-for-a-given-branch' into 'master'
Allow to enable `rspec_profiling` for a branch on the CI Closes #30907 See merge request !10680
-rw-r--r--spec/spec_helper.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index a3665795452..e67ad8f3455 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -9,8 +9,14 @@ require 'rspec/rails'
require 'shoulda/matchers'
require 'rspec/retry'
-if (ENV['RSPEC_PROFILING_POSTGRES_URL'] || ENV['RSPEC_PROFILING']) &&
- (!ENV.has_key?('CI') || ENV['CI_COMMIT_REF_NAME'] == 'master')
+rspec_profiling_is_configured =
+ ENV['RSPEC_PROFILING_POSTGRES_URL'] ||
+ ENV['RSPEC_PROFILING']
+branch_can_be_profiled =
+ ENV['CI_COMMIT_REF_NAME'] == 'master' ||
+ ENV['CI_COMMIT_REF_NAME'] =~ /rspec-profile/
+
+if rspec_profiling_is_configured && (!ENV.key?('CI') || branch_can_be_profiled)
require 'rspec_profiling/rspec'
end