Skip to content

Commit 8d1b978

Browse files
committed
fix(test): Stub MySQL connect method instead of calling the original
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
1 parent e6df315 commit 8d1b978

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

test/driver/index_test.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ var indexConnectCallback = function(self, tunnelStub, driverSpy) {
2424
self.callback(err, db, tunnelStub, driverSpy);
2525
return;
2626
}
27-
db.close(function() {
28-
self.callback(err, db, tunnelStub, driverSpy);
29-
});
27+
28+
self.callback(err, db, tunnelStub, driverSpy);
3029
};
3130
};
3231

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

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

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

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

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

0 commit comments

Comments
 (0)