Skip to content

Commit

Permalink
fix(test): Stub MySQL connect method instead of calling the original
Browse files Browse the repository at this point in the history
The MySQL driver now connects directly to the driver, instead on the first query. This
caused some trouble with the ssh tunnel test, this functionality was stubbed.

Fixes #348
  • Loading branch information
wzrdtales committed Feb 3, 2016
1 parent e6df315 commit 8d1b978
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions test/driver/index_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ var indexConnectCallback = function(self, tunnelStub, driverSpy) {
self.callback(err, db, tunnelStub, driverSpy);
return;
}
db.close(function() {
self.callback(err, db, tunnelStub, driverSpy);
});

self.callback(err, db, tunnelStub, driverSpy);
};
};

Expand All @@ -38,7 +37,7 @@ vows.describe('index').addBatch({
var driver = require('db-migrate-mysql');

// Set up stubs/spies to verify correct flow
var driverSpy = sinon.spy(driver, 'connect');
var driverSpy = sinon.stub(driver, 'connect').yields(null, {});
var tunnelStub = sinon.stub().callsArg(1);

var index = proxyquire('../../lib/driver/index', {
Expand Down Expand Up @@ -87,7 +86,7 @@ vows.describe('index').addBatch({

// Set up stubs/spies to verify correct flow
var tunnelStub = sinon.stub().callsArgWith(1, new Error('error'));
var driverSpy = sinon.spy(driver, 'connect');
var driverSpy = sinon.stub(driver, 'connect').yields(null, {});

var index = proxyquire('../../lib/driver/index', {
'tunnel-ssh': tunnelStub,
Expand Down

0 comments on commit 8d1b978

Please sign in to comment.