Sha256: 5ad6e92df5265b158db17e9d43557b790031247cd433fafcc964e6127cc1987f

Contents?: true

Size: 674 Bytes

Versions: 18

Compression:

Stored size: 674 Bytes

Contents

class Baza::InfoActiveRecordPg
  attr_reader :db

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

    @conn_pool ||= ::ActiveRecord::Base.establish_connection(
      adapter: "postgresql",
      host: "localhost",
      database: "baza-test",
      username: "baza-test",
      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

18 entries across 18 versions & 1 rubygems

Version Path
baza-0.0.38 spec/info_active_record_pg_example.rb
baza-0.0.37 spec/info_active_record_pg_example.rb
baza-0.0.36 spec/info_active_record_pg_example.rb
baza-0.0.35 spec/info_active_record_pg_example.rb
baza-0.0.34 spec/info_active_record_pg_example.rb
baza-0.0.33 spec/info_active_record_pg_example.rb
baza-0.0.32 spec/info_active_record_pg_example.rb
baza-0.0.31 spec/info_active_record_pg_example.rb
baza-0.0.30 spec/info_active_record_pg_example.rb
baza-0.0.29 spec/info_active_record_pg_example.rb
baza-0.0.28 spec/info_active_record_pg_example.rb
baza-0.0.27 spec/info_active_record_pg_example.rb
baza-0.0.26 spec/info_active_record_pg_example.rb
baza-0.0.25 spec/info_active_record_pg_example.rb
baza-0.0.24 spec/info_active_record_pg_example.rb
baza-0.0.23 spec/info_active_record_pg_example.rb
baza-0.0.22 spec/info_active_record_pg_example.rb
baza-0.0.21 spec/info_active_record_pg_example.rb