Sha256: 6015daa1cb8e52ce8ce61f0443a61d3da307096395863839554f0ad40b5e7bd1
Contents?: true
Size: 755 Bytes
Versions: 2
Compression:
Stored size: 755 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.exists?(path) @conn_pool ||= ::ActiveRecord::Base.establish_connection( adapter: "sqlite3", database: path ) @conn ||= @conn_pool.connection return {pool: @conn_pool, conn: @conn} end def initialize(args = {}) data = Baza::InfoActiveRecordSqlite3.connection @db = Baza::Db.new({ type: :active_record, conn: data[:conn] }.merge(args)) end def before @db.tables.list.each do |name, table| table.drop end end def after @db.close end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
baza-0.0.19 | spec/info_active_record_sqlite3.rb |
baza-0.0.18 | spec/info_active_record_sqlite3.rb |