Sha256: 8c6d565c758b8b0cf0e83df5121388af3f4587dc54e5ae8cccda9306ead64fd4

Contents?: true

Size: 713 Bytes

Versions: 1

Compression:

Stored size: 713 Bytes

Contents

class Baza::InfoActiveRecordMysql2
  attr_reader :db

  def self.connection
    require "active_record"
    require "activerecord-jdbc-adapter" if RUBY_PLATFORM == "java"

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

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

  def initialize(args = {})
    data = Baza::InfoActiveRecordMysql2.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_mysql2_peak_flow.rb