Sha256: 725a27d54bf3bad72f970ac278a7a25f98a4ee10f968df90e4de45993bfcd8de
Contents?: true
Size: 758 Bytes
Versions: 18
Compression:
Stored size: 758 Bytes
Contents
class Baza::InfoActiveRecordMysql attr_reader :db def self.connection require "active_record" require "activerecord-jdbc-adapter" if RUBY_PLATFORM == "java" @conn_pool ||= ::ActiveRecord::Base.establish_connection( adapter: "mysql", 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::InfoActiveRecordMysql.connection data.fetch(:conn).reconnect! @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