Skip to content

Commit

Permalink
Ensure that the used connection is always the one of the transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
sdepold committed Apr 16, 2014
1 parent 01fcc3b commit 9051fcc
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions test/associations/has-one.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,19 @@ describe(Support.getTestDialectTeaser("HasOne"), function() {
User.create({ username: 'foo' }).success(function(user) {
Group.create({ name: 'bar' }).success(function(group) {
sequelize.transaction(function(t) {
group.setUser(user, { transaction: t }).success(function() {
Group.all().success(function(groups) {
groups[0].getUser().success(function(associatedUser) {
expect(associatedUser).to.be.null
t.rollback().success(function() { done() })
group
.setUser(user, { transaction: t })
.success(function() {
Group.all().success(function(groups) {
groups[0].getUser().success(function(associatedUser) {
expect(associatedUser).to.be.null
t.rollback().success(function() { done() })
})
})
})
})
.on('sql', function(sql, uuid) {
expect(uuid).to.not.equal('default')
})
})
})
})
Expand Down

0 comments on commit 9051fcc

Please sign in to comment.