summaryrefslogtreecommitdiff
path: root/config/initializers/rspec_profiling.rb
diff options
context:
space:
mode:
authorNick Thomas <nick@gitlab.com>2017-01-26 21:31:43 +0000
committerNick Thomas <nick@gitlab.com>2017-01-27 12:41:16 +0000
commitf83b8bd42c2a82b3ef9a8d93621b3955f0a8d0ca (patch)
tree50f6d5128a2941f019e6e19cee47efe8d3ebce9b /config/initializers/rspec_profiling.rb
parent9d7999242db6ab641df1351bae7cfd5766cfeaa3 (diff)
downloadgitlab-ce-f83b8bd42c2a82b3ef9a8d93621b3955f0a8d0ca.tar.gz
Add the rspec_profiling gem and documentation to the GitLab development environment23034-enable-rspec-profiling
Diffstat (limited to 'config/initializers/rspec_profiling.rb')
-rw-r--r--config/initializers/rspec_profiling.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/config/initializers/rspec_profiling.rb b/config/initializers/rspec_profiling.rb
new file mode 100644
index 00000000000..f462e654b2c
--- /dev/null
+++ b/config/initializers/rspec_profiling.rb
@@ -0,0 +1,14 @@
+module RspecProfilingConnection
+ def establish_connection
+ ::RspecProfiling::Collectors::PSQL::Result.establish_connection(ENV['RSPEC_PROFILING_POSTGRES_URL'])
+ end
+end
+
+if Rails.env.test?
+ RspecProfiling.configure do |config|
+ if ENV['RSPEC_PROFILING_POSTGRES_URL']
+ RspecProfiling::Collectors::PSQL.prepend(RspecProfilingConnection)
+ config.collector = RspecProfiling::Collectors::PSQL
+ end
+ end
+end