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

Commit 42988bf2 by Sascha Gehlich

Bugfix: Make sure DAO#find() takes `transaction` option in first parameter

1 parent e1031475
Showing with 20 additions and 1 deletions
......@@ -536,7 +536,7 @@ module.exports = (function() {
plain: true,
type: 'SELECT',
hasJoin: hasJoin
}, queryOptions))
}, queryOptions, { transaction: (options || {}).transaction }))
}
DAOFactory.prototype.aggregate = function(field, aggregateFunction, options) {
......
......@@ -466,6 +466,25 @@ describe(Support.getTestDialectTeaser("DAOFactory"), function () {
})
})
describe('find', function() {
it.only('supports the transaction option in the first parameter', function(done) {
Support.prepareTransactionTest(this.sequelize, function(sequelize) {
var User = sequelize.define('User', { username: Sequelize.STRING, foo: Sequelize.STRING })
User.sync({ force: true }).success(function() {
sequelize.transaction(function(t) {
User.create({ username: 'foo' }, { transaction: t }).success(function() {
User.find({ where: { username: 'foo' }, transaction: t }).success(function(user) {
expect(user).to.not.be.null
t.rollback().success(function() { done() })
})
})
})
})
})
})
})
describe('findOrInitialize', function() {
it('supports transactions', function(done) {
Support.prepareTransactionTest(this.sequelize, function(sequelize) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!