Sha256: 868cc92d128dcf11d97ace3a41eb6336bdc15d653cc83cd4ede60360f087575f

Contents?: true

Size: 926 Bytes

Versions: 5

Compression:

Stored size: 926 Bytes

Contents

require 'test/unit'
require 'fileutils'

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

        def test_base
            assert_equal(@dbh.driver_name, "Pg")
            assert_kind_of(DBI::DBD::Pg::Database, @dbh.instance_variable_get(:@handle))
        end

        def set_base_dbh
            config = DBDConfig.get_config['postgresql']
            @dbh = DBI.connect("dbi:Pg:#{config['dbname']}", config['username'], config['password'])
        end

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

        def teardown
            @sth.finish if @sth && !@sth.finished?
            config = DBDConfig.get_config['postgresql']
            DBDConfig.inject_sql(@dbh, dbtype, "dbd/postgresql/down.sql")
            @dbh.disconnect
        end
    end
)

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
dbd-pg-0.3.3 test/dbd/postgresql/base.rb
dbd-pg-0.3.5 test/dbd/postgresql/base.rb
dbd-pg-0.3.4 test/dbd/postgresql/base.rb
dbd-pg-0.3.6 test/dbd/postgresql/base.rb.new
dbd-pg-0.3.7 test/dbd/postgresql/base.rb.new