Sha256: 34ef9adbdb2d0d0156e5e73179a82e54925a7b41ac03adf5ecea721dd42bf05a

Contents?: true

Size: 871 Bytes

Versions: 8

Compression:

Stored size: 871 Bytes

Contents

# frozen_string_literal: true

require 'rubygems'
require 'bundler/setup'
require 'active_record'
require_relative '../lib/rails-pg-extras'

pg_version = ENV["PG_VERSION"]

port = if pg_version == "11"
  "5432"
elsif pg_version == "12"
  "5433"
elsif pg_version == "13"
  "5434"
else
  "5432"
end

ENV["DATABASE_URL"] ||= "postgresql://postgres:secret@localhost:#{port}/rails-pg-extras-test"

RSpec.configure do |config|
  config.before :suite do
    ActiveRecord::Base.establish_connection(
      ENV.fetch("DATABASE_URL")
    )
    RailsPGExtras.connection.execute("CREATE EXTENSION IF NOT EXISTS pg_stat_statements;")
    RailsPGExtras.connection.execute("CREATE EXTENSION IF NOT EXISTS pg_buffercache;")
    RailsPGExtras.connection.execute("CREATE EXTENSION IF NOT EXISTS sslinfo;")
  end

  config.after :suite do
    ActiveRecord::Base.remove_connection
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rails-pg-extras-3.3.0 spec/spec_helper.rb
rails-pg-extras-3.2.7 spec/spec_helper.rb
rails-pg-extras-3.2.6 spec/spec_helper.rb
rails-pg-extras-3.2.5 spec/spec_helper.rb
rails-pg-extras-3.2.4 spec/spec_helper.rb
rails-pg-extras-3.2.3 spec/spec_helper.rb
rails-pg-extras-3.2.2 spec/spec_helper.rb
rails-pg-extras-3.1.0 spec/spec_helper.rb