Skip to content

Commit

Permalink
- Fixed a bug where setting pool or debug in the connection string p…
Browse files Browse the repository at this point in the history
…assed to ORM.connect would always be set to true.

 - Wrote a test to demonstrate the passing.
  • Loading branch information
BelfordZ committed Dec 12, 2013
1 parent f14b76e commit ee9b064
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/ORM.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ exports.connect = function (opts, cb) {
var debug = extractOption(opts, "debug");
var pool = extractOption(opts, "pool");
var driver = new Driver(opts, null, {
debug : (debug !== null ? Boolean(debug) : settings.get("connection.debug")),
pool : (pool !== null ? Boolean(pool) : settings.get("connection.pool")),
debug : (debug !== null ? ((debug === "false" || debug === "0") ? false : true) : settings.get("connection.debug")),
pool : (pool !== null ? ((pool === "false" || pool === "0") ? false : true) : settings.get("connection.pool")),
settings : settings
});

Expand Down
9 changes: 9 additions & 0 deletions test/integration/orm-exports.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,15 @@ describe("ORM.connect()", function () {
return done();
});
});

it("should allow pool and debug settings to be false", function(done) {
var connString = common.getConnectionString() + "debug=false&pool=false";
ORM.connect(connString, function(err, db) {
db.driver.opts.pool.should.equal(false);
db.driver.opts.debug.should.equal(false);
done();
});
});
});
});

Expand Down

0 comments on commit ee9b064

Please sign in to comment.