Sha256: 6224ad077400c3a1a7f0d47d022229e47600f349b72b2789c569343e89e26f72

Contents?: true

Size: 690 Bytes

Versions: 6

Compression:

Stored size: 690 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: "travis"
    )
    @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

6 entries across 6 versions & 1 rubygems

Version Path
baza-0.0.26 spec/info_active_record_mysql2_travis.rb
baza-0.0.25 spec/info_active_record_mysql2_travis.rb
baza-0.0.24 spec/info_active_record_mysql2_travis.rb
baza-0.0.23 spec/info_active_record_mysql2_travis.rb
baza-0.0.22 spec/info_active_record_mysql2_travis.rb
baza-0.0.21 spec/info_active_record_mysql2_travis.rb