19 lines
587 B
Ruby
19 lines
587 B
Ruby
class SpecDb
|
|
|
|
TEST_DB_NAME="jam_ruby_test"
|
|
|
|
TEST_USER_ID = "1" #test@jamkazam.com
|
|
def self.recreate_database
|
|
conn = PG::Connection.open("dbname=postgres user=postgres password=postgres host=localhost")
|
|
conn.exec("DROP DATABASE IF EXISTS #{TEST_DB_NAME}")
|
|
if ENV['TABLESPACE']
|
|
conn.exec("CREATE DATABASE #{TEST_DB_NAME} WITH TABLESPACE=#{ENV['TABLESPACE']}")
|
|
else
|
|
conn.exec("CREATE DATABASE #{TEST_DB_NAME}")
|
|
end
|
|
|
|
|
|
JamDb::Migrator.new.migrate(:dbname => TEST_DB_NAME, :user => "postgres", :password => "postgres", :host => "localhost")
|
|
end
|
|
end
|