This unit test failed because the object user was added twice into the collection membership
The method collection.add was recursively called:
the first time in the unit test
the second time by the method Collection.model through the call User.create({...})
test('has.One and has.Many should play nicly together', function(t) {
var user = User.create({id: 1});
var memberships = user.memberships().add({id: 1, user_id: 1})
t.is(user.memberships().length, 1);
t.end();
});
This unit test failed because the object user was added twice into the collection membership The method collection.add was recursively called:
test('has.One and has.Many should play nicly together', function(t) { var user = User.create({id: 1}); var memberships = user.memberships().add({id: 1, user_id: 1}) t.is(user.memberships().length, 1); t.end(); });