Sha256: ea1c32ee6ab92b9f11e6382dda1a78735e346d4952c3586fc07d9cbd45f9b467

Contents?: true

Size: 587 Bytes

Versions: 2

Compression:

Stored size: 587 Bytes

Contents

class Baza::InfoSqlite3
  attr_reader :db

  def initialize(args = {})
    require "sqlite3" unless RUBY_ENGINE == "jruby"
    require "tmpdir"

    @path = "#{Dir.tmpdir}/baza_sqlite3_test_#{Time.now.to_f.to_s.hash}_#{Random.rand}.sqlite3"
    File.unlink(path) if File.exists?(@path)

    @db = Baza::Db.new({
      type: :sqlite3,
      path: @path,
      index_append_table_name: true,
      sql_to_error: true
    }.merge(args))
  end

  def before
    @db.tables.list.each do |name, table|
      table.drop
    end
  end

  def after
    @db.close
    File.unlink(@path)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
baza-0.0.19 spec/info_sqlite3.rb
baza-0.0.18 spec/info_sqlite3.rb