Sha256: c16fd94c6cb6f4579b843c186f7356b8837699a2cc237025a8763e01afabbf71

Contents?: true

Size: 660 Bytes

Versions: 1

Compression:

Stored size: 660 Bytes

Contents

class Baza::InfoActiveRecordPg
  attr_reader :db

  def self.connection
    require "active_record"
    require "pg"

    @conn_pool = ::ActiveRecord::Base.establish_connection(
      adapter: "postgresql",
      database: "baza",
      host: "postgres",
      username: "build",
      password: "password"
    )
    @conn = @conn_pool.connection

    {pool: @conn_pool, conn: @conn}
  end

  def initialize(args = {})
    data = Baza::InfoActiveRecordPg.connection

    @db = Baza::Db.new({
      type: :active_record,
      conn: data.fetch(:conn)
    }.merge(args))
  end

  def before
    @db.tables.list(&:drop)
  end

  def after
    @db.close
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
baza-0.0.38 spec/info_active_record_pg_peak_flow.rb