Sha256: 8f727954241392ef924abc58432d08315056322390b4ae1181fa98c2ab4e7c37

Contents?: true

Size: 1003 Bytes

Versions: 2

Compression:

Stored size: 1003 Bytes

Contents

require 'test/unit'
require 'fileutils'

DBDConfig.set_testbase(:sqlite3, Class.new(Test::Unit::TestCase) do
        def dbtype 
            "sqlite3"
        end

        def test_base
            if @dbh # FIXME for some reason, @dbh isn't initialized in some cases. investigate.
                assert_equal(@dbh.driver_name, "SQLite3")
                assert_kind_of(DBI::DBD::SQLite3::Database, @dbh.instance_variable_get(:@handle))
            end
        end

        def set_base_dbh
            config = DBDConfig.get_config['sqlite3']
            @dbh = DBI.connect('dbi:SQLite3:'+config['dbname'], nil, nil, { }) 
        end

        def setup
            set_base_dbh
            DBDConfig.inject_sql(@dbh, dbtype, "dbd/sqlite3/up.sql")
        end

        def teardown
            @sth.finish if(@sth && !@sth.finished?)
            @dbh.disconnect if @dbh.connected?
            config = DBDConfig.get_config['sqlite3']
            FileUtils.rm_f(config['dbname'])
        end
    end
)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dbd-sqlite3-1.2.2 test/dbd/sqlite3/base.rb
dbd-sqlite3-1.2.3 test/dbd/sqlite3/base.rb