diff options
author | Rémy Coutable <remy@rymai.me> | 2017-04-13 15:24:35 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2017-04-13 15:24:35 +0300 |
commit | d6550d255c62f736eaacb7f30133c0932bed644d (patch) | |
tree | a6b0352c71028b557bf559ee2253109a758c2f45 /spec/spec_helper.rb | |
parent | 7629c9ec57cb9b14f41c1163b61df1e6ea6b0ca1 (diff) |
Allow to enable `rspec_profiling` for a branch on the CI
`rspec_profiling` will be enabled if the branch name includes
`rspec-profile`.
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/spec_helper.rb')
-rw-r--r-- | spec/spec_helper.rb | 10 |
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 |