Skip to content

Commit

Permalink
https://github.com/apocas/dockerode/issues/343
Browse files Browse the repository at this point in the history
  • Loading branch information
apocas committed Mar 10, 2017
1 parent 014f5be commit df1efec
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
13 changes: 11 additions & 2 deletions lib/docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,18 @@ var EventEmitter = require('events').EventEmitter,
var Docker = function(opts) {
if (!(this instanceof Docker)) return new Docker(opts);

this.modem = new Modem(opts);
var plibrary = global.Promise;

if(opts && opts.Promise) {
plibrary = opts.Promise;

if(Object.keys(opts).length === 1) {
opts = undefined;
}
}

this.modem.Promise = opts && opts.Promise || global.Promise;
this.modem = new Modem(opts);
this.modem.Promise = plibrary;
};

/**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "dockerode",
"description": "Docker Remote API module.",
"version": "2.3.4",
"version": "2.3.5",
"author": "Pedro Dias <[email protected]>",
"maintainers": [
"apocas <[email protected]>"
Expand Down
21 changes: 20 additions & 1 deletion test/docker.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
/*jshint -W030 */

var expect = require('chai').expect;
var Bluebird = require('bluebird'),
expect = require('chai').expect,
Docker = require('../lib/docker');

var docker = require('./spec_helper').docker;
var dockert = require('./spec_helper').dockert;


var testImage = 'ubuntu:14.04';
var testVolume = {
"Name": "tardis",
Expand All @@ -13,6 +17,21 @@ var testVolume = {

describe("#docker", function() {

describe("#constructors", function() {
it("should work without options", function(done) {
var d = new Docker();
expect(d.modem.socketPath).not.to.be.null;
done();
});
it("should not send Promise options to docker-modem", function(done) {
var d = new Docker({
'Promise': Bluebird
});
expect(d.modem.socketPath).not.to.be.null;
done();
});
});

describe("#checkAuth", function() {
it("should fail auth", function(done) {
this.timeout(15000);
Expand Down

0 comments on commit df1efec

Please sign in to comment.