it('does not leak variables to the outer scope',function(){
it('does not leak variables to the outer scope',function(){
// This is a little tricky. We want to check the values in the outer scope, when the transaction has been successfully set up, but before it has been comitted.
// This is a little tricky. We want to check the values in the outer scope, when the transaction has been successfully set up, but before it has been comitted.
// We can't just call another function from inside that transaction, since that would transfer the context to that function - exactly what we are trying to prevent;
// We can't just call another function from inside that transaction, since that would transfer the context to that function - exactly what we are trying to prevent;
varself=this
varself=this
,transactionSetup=false
,transactionSetup=false
,transactionEnded=false;
,transactionEnded=false;
cb(this.sequelize,function(){
cb(this.sequelize,function(){
transactionSetup=true;
transactionSetup=true;
returnPromise.delay(500).then(function(){
returnPromise.delay(500).then(function(){
expect(self.ns.get('transaction')).to.be.ok;
expect(self.ns.get('transaction')).to.be.ok;
transactionEnded=true;
transactionEnded=true;
});
});
});
});
// Wait for 400 ms - should be enough time to get everything set up