Skip to content

Commit

Permalink
do not forward rdb from old domain
Browse files Browse the repository at this point in the history
  • Loading branch information
lroal committed Sep 2, 2015
1 parent f9161f5 commit d4fe4b2
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 8 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -10,6 +10,8 @@ Eager or lazy loading.
Based on promises.
[Documentation and examples](docs/docs.md)
## Release notes
__1.0.6__
Bugfix: Transaction domain should not forward rdb singleton from old domain.
__1.0.5__
Documentation cleanup.
__1.0.4__
Expand Down
1 change: 1 addition & 0 deletions createDomain/negotiateForwardProperty.js
@@ -1,5 +1,6 @@
function negotiateForwardProperty(oldDomain, newDomain, propertyName) {
if(newDomain[propertyName]) return;
if (propertyName === 'rdb') return;
Object.defineProperty(newDomain, propertyName, {
enumerable: true,
get: createGetter(oldDomain, propertyName),
Expand Down
21 changes: 21 additions & 0 deletions createDomain/negotiateForwardPropertySpec/negotiateExisting.js
@@ -0,0 +1,21 @@
var a = require('a');

function act(c){
c.mock = a.mock;
c.requireMock = a.requireMock;
c.expectRequire = a.expectRequire;
c.then = a.then;

c.newDomain = {};
c.oldDomain = {};

c.oldFoo = {};
c.existingFoo = {};
c.oldDomain.foo = c.oldFoo;
c.newDomain.foo = c.existingFoo;
c.propertyName = 'foo';

require('../negotiateForwardProperty')(c.oldDomain, c.newDomain, c.propertyName);
}

module.exports = act;
20 changes: 20 additions & 0 deletions createDomain/negotiateForwardPropertySpec/negotiateRdb.js
@@ -0,0 +1,20 @@
var a = require('a');

function act(c){
c.mock = a.mock;
c.requireMock = a.requireMock;
c.expectRequire = a.expectRequire;
c.then = a.then;

c.newDomain = {};
c.oldDomain = {};

c.oldRdb = {};
c.oldDomain.rdb = c.oldRdb;
c.propertyName = 'rdb';

require('../negotiateForwardProperty')(c.oldDomain, c.newDomain, c.propertyName);

}

module.exports = act;

This file was deleted.

@@ -0,0 +1,5 @@
var when = require('a').when;
var c = {};

when(c)
.it('should not forward existing').assertEqual(c.newDomain.foo, c.existingFoo)
6 changes: 6 additions & 0 deletions createDomain/negotiateForwardPropertySpec/whenNegotiateFoo.js
@@ -0,0 +1,6 @@
var when = require('a').when;
var c = {};

when(c)
.it('should forward property getter through new domain').assertEqual(c.oldFoo, c.originalValue)
.it('should update value on old domain when setting on new domain').assertEqual(c.newFoo, c.oldDomain.foo)
5 changes: 5 additions & 0 deletions createDomain/negotiateForwardPropertySpec/whenNegotiateRdb.js
@@ -0,0 +1,5 @@
var when = require('a').when;
var c = {};

when(c)
.it('should not forward rdb').assertNotEqual(c.oldDomain.rdb, c.newDomain.rdb)
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "rdb",
"version": "1.0.5",
"version": "1.0.6",
"main": "index.js",
"title": "rdb",
"description": "Object Relational Mapper",
Expand Down

0 comments on commit d4fe4b2

Please sign in to comment.