* making jam-web's test use the database.yml's test configs for connection info, not defaults (which is unix domain socket)

This commit is contained in:
Seth Call 2012-11-17 20:32:29 -06:00
parent 8b65f6063f
commit 2e61b2ba00
1 changed files with 5 additions and 3 deletions

View File

@ -7,13 +7,15 @@ class SpecDb
end
def self.recreate_database_jdbc(db_config)
original = db_config["database"]
original = db_config["database"]
# jump into the 'postgres' database, just so we have somewhere to 'land' other than our test db,
# since we are going to drop/recreate it
db_config["database"] = "postgres"
ActiveRecord::Base.establish_connection(db_config)
ActiveRecord::Base.connection.execute("DROP DATABASE IF EXISTS #{TEST_DB_NAME}")
ActiveRecord::Base.connection.execute("CREATE DATABASE #{TEST_DB_NAME}")
JamDb::Migrator.new.migrate(:dbname => TEST_DB_NAME)
db_config["database"] = original
db_config["database"] = original
JamDb::Migrator.new.migrate(:dbname => TEST_DB_NAME, :user => db_config["username"], :password => db_config["password"], :host => db_config["host"])
end
def self.recreate_database_pg