Sha256: 0c6ebee07ee70a8e9c944f0b5aa7999394f98cb5a3c20937c4fc63f0f544b5f5
Contents?: true
Size: 751 Bytes
Versions: 15
Compression:
Stored size: 751 Bytes
Contents
class Baza::InfoActiveRecordSqlite3 attr_reader :db def self.connection require "active_record" path = "#{Dir.tmpdir}/baza_sqlite3_test_#{Time.now.to_f.to_s.hash}_#{Random.rand}.sqlite3" File.unlink(path) if File.exist?(path) @conn_pool ||= ::ActiveRecord::Base.establish_connection( adapter: "sqlite3", database: path ) @conn ||= @conn_pool.connection {pool: @conn_pool, conn: @conn} end def initialize(args = {}) data = Baza::InfoActiveRecordSqlite3.connection @db = Baza::Db.new({ type: :active_record, conn: data.fetch(:conn), index_append_table_name: true }.merge(args)) end def before @db.tables.list(&:drop) end def after @db.close end end
Version data entries
15 entries across 15 versions & 1 rubygems