Skip to content

Commit

Permalink
Merge pull request #20 Version 2.1.1
Browse files Browse the repository at this point in the history
Version 2.1.1
  • Loading branch information
robsonbittencourt authored May 27, 2017
2 parents 285d028 + e47fd46 commit 6aaf8c6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gear-jenkins",
"version": "2.1.0",
"version": "2.1.1",
"description": "A Hubot Gear for handle Jenkins tasks",
"main": "/src/jenkins.js",
"scripts": {
Expand Down Expand Up @@ -35,7 +35,7 @@
"chai-as-promised": "^6.0.0",
"sinon": "^1.17.7",
"sinon-as-promised": "^4.0.3",
"mocha": "^3.4.1",
"mocha": "^3.4.2",
"proxyquire": "^1.8.0",
"istanbul": "^0.4.5",
"coveralls": "^2.13.1",
Expand Down
4 changes: 2 additions & 2 deletions src/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

exports.getDb = getDb;

const sqlite = require('sqlite');
const path = require('path');
const sqlite = require('sqlite');

let database;

Expand Down Expand Up @@ -38,5 +38,5 @@ function migrate(sqliteDb) {
}

function gearPath() {
return path.resolve(process.cwd(), 'node_modules/gear-jenkins/');
return path.resolve(__dirname, '../');
}
13 changes: 9 additions & 4 deletions test/db.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
'use strict';

require('sinon-as-promised');
const path = require('path');
const sinon = require('sinon');
const expect = require('chai').expect;
const proxyquire = require('proxyquire').noPreserveCache();
Expand All @@ -23,11 +24,13 @@ describe('Data base creation', () => {

db.getDb();

expect(openSpy.calledWith(`${process.cwd()}/node_modules/gear-jenkins/gear-jenkins.sqlite`)).to.be.true;
const basePath = path.resolve(__dirname, '../');

expect(openSpy.calledWith(`${basePath}/gear-jenkins.sqlite`)).to.be.true;

migrateSpy().then(() => {
expect(migrateSpy.calledWithMatch(
{ migrationsPath: `${process.cwd()}/node_modules/gear-jenkins/migrations` })).to.be.true;
{ migrationsPath: `${basePath}/migrations` })).to.be.true;
});
});

Expand All @@ -43,9 +46,11 @@ describe('Data base creation', () => {

db.getDb();

expect(openSpy.calledWith(`${process.cwd()}/node_modules/gear-jenkins/gear-jenkins.sqlite`)).to.be.true;
const basePath = path.resolve(__dirname, '../');

expect(openSpy.calledWith(`${basePath}/gear-jenkins.sqlite`)).to.be.true;
expect(migrateSpy.calledWithMatch(
{ migrationsPath: `${process.cwd()}/node_modules/gear-jenkins/migrations` })).to.be.false;
{ migrationsPath: `${basePath}/migrations` })).to.be.false;
});

it('do nothing when error occurs on migration', () => {
Expand Down

0 comments on commit 6aaf8c6

Please sign in to comment.