Sha256: 704c11efcb96bcb00824149d3e343e9c7b621f7539030ff17334d8c7912900c0

Contents?: true

Size: 672 Bytes

Versions: 2

Compression:

Stored size: 672 Bytes

Contents

class Baza::InfoActiveRecord
  attr_reader :db

  def self.connection
    require "active_record"

    @conn_pool ||= ::ActiveRecord::Base.establish_connection(
      adapter: "mysql2",
      host: "localhost",
      database: "baza-test",
      username: "baza-test",
      password: "BBH7djRUKzL5nmG3"
    )
    @conn ||= @conn_pool.connection

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

  def initialize
    data = Baza::InfoActiveRecord.connection

    @db = Baza::Db.new(
      type: :active_record,
      conn: data[:conn]
    )
  end

  def before
    @db.tables.list.each do |name, table|
      table.drop
    end
  end

  def after
    @db.close
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
baza-0.0.15 spec/info_active_record.rb
baza-0.0.14 spec/info_active_record.rb