summaryrefslogtreecommitdiff
path: root/config/initializers/rspec_profiling.rb
blob: f462e654b2cc1251dd860b8adcbad1b4681a9286 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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