test: remove global autoAttach
This commit is contained in:
parent
b61fae58f6
commit
699bc7aa97
|
@ -501,9 +501,11 @@ describe.onServer('Remote Methods', function() {
|
||||||
describe('Model._getACLModel()', function() {
|
describe('Model._getACLModel()', function() {
|
||||||
it('should return the subclass of ACL', function() {
|
it('should return the subclass of ACL', function() {
|
||||||
var Model = require('../').Model;
|
var Model = require('../').Model;
|
||||||
|
var originalValue = Model._ACL();
|
||||||
var acl = ACL.extend('acl');
|
var acl = ACL.extend('acl');
|
||||||
Model._ACL(null); // Reset the ACL class for the base model
|
Model._ACL(null); // Reset the ACL class for the base model
|
||||||
var model = Model._ACL();
|
var model = Model._ACL();
|
||||||
|
Model._ACL(originalValue); // Reset the value back
|
||||||
assert.equal(model, acl);
|
assert.equal(model, acl);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,6 +3,7 @@ describe('loopback.rest', function() {
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
var ds = app.dataSource('db', { connector: loopback.Memory });
|
var ds = app.dataSource('db', { connector: loopback.Memory });
|
||||||
MyModel = ds.createModel('MyModel', {name: String});
|
MyModel = ds.createModel('MyModel', {name: String});
|
||||||
|
loopback.autoAttach();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('works out-of-the-box', function(done) {
|
it('works out-of-the-box', function(done) {
|
||||||
|
|
|
@ -30,9 +30,6 @@ beforeEach(function() {
|
||||||
{type: 'STUB'}
|
{type: 'STUB'}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
// auto attach data sources to models
|
|
||||||
loopback.autoAttach();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
assertValidDataSource = function(dataSource) {
|
assertValidDataSource = function(dataSource) {
|
||||||
|
|
|
@ -23,6 +23,7 @@ describe('User', function() {
|
||||||
|
|
||||||
// Update the AccessToken relation to use the subclass of User
|
// Update the AccessToken relation to use the subclass of User
|
||||||
AccessToken.belongsTo(User);
|
AccessToken.belongsTo(User);
|
||||||
|
User.hasMany(AccessToken);
|
||||||
|
|
||||||
// allow many User.afterRemote's to be called
|
// allow many User.afterRemote's to be called
|
||||||
User.setMaxListeners(0);
|
User.setMaxListeners(0);
|
||||||
|
@ -1071,6 +1072,7 @@ describe('User', function() {
|
||||||
assert.equal(info.accessToken.ttl / 60, 15);
|
assert.equal(info.accessToken.ttl / 60, 15);
|
||||||
assert(calledBack);
|
assert(calledBack);
|
||||||
info.accessToken.user(function(err, user) {
|
info.accessToken.user(function(err, user) {
|
||||||
|
if (err) return done(err);
|
||||||
assert.equal(user.email, email);
|
assert.equal(user.email, email);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue