Merge pull request #2697 from strongloop/fix/various

Fix app.enableAuth and test/user
This commit is contained in:
Miroslav Bajtoš 2016-09-01 16:49:36 +02:00 committed by GitHub
commit f362084770
2 changed files with 3 additions and 2 deletions

View File

@ -328,8 +328,10 @@ app.enableAuth = function(options) {
g.f('Authentication requires model %s to be defined.', m));
}
if (m.dataSource || m.app) return;
if (Model.dataSource || Model.app) return;
// Find descendants of Model that are attached,
// for example "Customer" extending "User" model
for (var name in appModels) {
var candidate = appModels[name];
var isSubclass = candidate.prototype instanceof Model;

View File

@ -66,7 +66,6 @@ describe('User', function() {
app.enableAuth({ dataSource: 'db' });
app.use(loopback.token({ model: AccessToken }));
app.use(loopback.rest());
app.model(User);
User.create(validCredentials, function(err, user) {
if (err) return done(err);