test/ts_dbd.rb in ydbd-pg-0.5.9 vs test/ts_dbd.rb in ydbd-pg-0.6.0
- old
+ new
@@ -1,17 +1,16 @@
require 'rubygems'
gem 'test-unit'
# figure out what tests to run
require 'yaml'
-require 'test/unit/testsuite'
+require "test/unit"
require 'test/unit/ui/console/testrunner'
-if File.basename(Dir.pwd) == "test"
- $:.unshift('../lib')
-else
- $:.unshift('lib')
-end
+Dir.chdir("..") if File.basename(Dir.pwd) == "test"
+$LOAD_PATH.unshift(Dir.pwd + "/lib")
+Dir.chdir("test") rescue nil
+$: << '.'
module Test::Unit::Assertions
def build_message(head, template=nil, *arguments)
template += "\n" + "DATABASE: " + dbtype
template &&= template.chomp
@@ -33,18 +32,24 @@
@testbase = { }
@current_dbtype = nil
def self.get_config
config = nil
-
- begin
- config = YAML.load_file(File.join(ENV["HOME"], ".ruby-dbi.test-config.yaml"))
- rescue Exception => e
+ if false
+ # ydbi is only interested in testing the postgresql database!!
+ begin
+ config = YAML.load_file(File.join(ENV["HOME"], ".ruby-dbi.test-config.yaml"))
+ rescue Exception => e
+ config = { }
+ config["dbtypes"] = [ ]
+ end
+ else
+ # please keep the definitions in sync between test/ts_dbd.rb and devenv.nix!
config = { }
- config["dbtypes"] = [ ]
+ config["dbtypes"] = [ "postgresql" ]
+ config["postgresql"] = {"username"=>"ydbi_pg", "password"=>"pg_password", "dbname"=>"ydbi_pg"}
end
-
return config
end
def self.inject_sql(dbh, dbtype, file)
# splits by --- in the file, strips newlines and the semicolons.
@@ -112,10 +117,10 @@
config["dbtypes"] = ENV["DBTYPES"].split(/\s+/) if ENV["DBTYPES"]
if config and config["dbtypes"]
config["dbtypes"].each do |dbtype|
unless config[dbtype]
- warn "#{dbtype} is selected for testing but not configured; see test/DBD_TESTS"
+ warn "#{dbtype} is selected for testing but not configured; see test/DBD_TESTS" if false
next
end
# base.rb is special, see DBD_TESTS
require "dbd/#{dbtype}/base.rb"