Skip to content

Commit

Permalink
fixed travis schema name and helper init logic
Browse files Browse the repository at this point in the history
  • Loading branch information
timgit committed May 11, 2016
1 parent 988ef66 commit 16a3524
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/testHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ var Db = require('../src/db');
var config = require('./config.json');
var PgBoss = require('../src/index');
var Promise = require('bluebird');
var Contractor = require('../src/contractor');

if(process.env.TRAVIS) {
config.port = 5433;
config.password = '';
config.schema = process.env.TRAVIS_JOB_ID;
config.schema = 'pgboss' + process.env.TRAVIS_JOB_ID;
}

module.exports = {
Expand All @@ -23,7 +24,12 @@ function getDb() {
}

function init() {
return getDb().executeSql(`truncate table ${config.schema}.job`)
var truncateJobTable = `truncate table ${config.schema}.job`;
var db = getDb();
var contractor = new Contractor(config);

return contractor.isInstalled()
.then(installed => installed ? db.execute(truncateJobTable) : null)
.catch(error => console.error(error));
}

Expand Down

0 comments on commit 16a3524

Please sign in to comment.