不要怂,就是干,撸起袖子干!

Commit 54a15e66 by Sascha Depold

added a test that makes sure, that query uses the passed DAOFactory

1 parent 3f3a797b
Showing with 17 additions and 1 deletions
......@@ -128,7 +128,14 @@ module.exports = (function() {
}
Sequelize.prototype.query = function(sql, callee, options) {
options = (arguments.length === 3) ? options : { raw: true }
if (arguments.length === 3) {
options = options
} else if (arguments.length === 2) {
options = {}
} else {
options = { raw: true }
}
options = Utils._.extend(Utils._.clone(this.options.query), options)
options = Utils._.extend(options, {
logging: this.options.hasOwnProperty('logging') ? this.options.logging : console.log,
......
......@@ -96,5 +96,14 @@ describe("[" + dialect.toUpperCase() + "] Sequelize", function() {
}.bind(this))
}.bind(this))
})
it('uses the passed DAOFactory', function(done) {
this.sequelize.query(this.insertQuery).success(function() {
this.sequelize.query("SELECT * FROM " + this.User.tableName + ";", this.User).success(function(users) {
expect(users[0].__factory).toEqual(this.User)
done()
}.bind(this))
}.bind(this))
})
})
})
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!