Sha256: 3972305a43ccad3e821e6ba8b61043f4bcf3c82f64f29e521792dc580f6d5e58

Contents?: true

Size: 689 Bytes

Versions: 11

Compression:

Stored size: 689 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: "localhost",
      database: "baza",
      username: "build"
    )
    @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

11 entries across 11 versions & 1 rubygems

Version Path
baza-0.0.37 spec/info_active_record_mysql2_peak_flow.rb
baza-0.0.36 spec/info_active_record_mysql2_peak_flow.rb
baza-0.0.35 spec/info_active_record_mysql2_peak_flow.rb
baza-0.0.34 spec/info_active_record_mysql2_peak_flow.rb
baza-0.0.33 spec/info_active_record_mysql2_peak_flow.rb
baza-0.0.32 spec/info_active_record_mysql2_peak_flow.rb
baza-0.0.31 spec/info_active_record_mysql2_travis.rb
baza-0.0.30 spec/info_active_record_mysql2_travis.rb
baza-0.0.29 spec/info_active_record_mysql2_travis.rb
baza-0.0.28 spec/info_active_record_mysql2_travis.rb
baza-0.0.27 spec/info_active_record_mysql2_travis.rb