From ee9b0644aef2fde7fb77cf4a3a6dddb1ab75bea8 Mon Sep 17 00:00:00 2001 From: belfordz Date: Wed, 11 Dec 2013 16:30:33 -0800 Subject: [PATCH] - Fixed a bug where setting pool or debug in the connection string passed to ORM.connect would always be set to true. - Wrote a test to demonstrate the passing. --- lib/ORM.js | 4 ++-- test/integration/orm-exports.js | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/ORM.js b/lib/ORM.js index fff4dd7a..8ac89230 100644 --- a/lib/ORM.js +++ b/lib/ORM.js @@ -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 }); diff --git a/test/integration/orm-exports.js b/test/integration/orm-exports.js index d6175b5a..9e143854 100644 --- a/test/integration/orm-exports.js +++ b/test/integration/orm-exports.js @@ -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(); + }); + }); }); });