Add root true to remote methods

This commit is contained in:
Ritchie 2013-07-24 17:21:15 -07:00
parent d3eed3b321
commit 8a7086be5c
4 changed files with 6 additions and 4 deletions

View File

@ -106,6 +106,8 @@ Model.setup = function () {
{path: '/'}, {path: '/'},
{path: '/:id'} {path: '/:id'}
]; ];
ModelCtor.sharedCtor.returns = {root: true};
return ModelCtor; return ModelCtor;
} }

View File

@ -264,7 +264,7 @@ User.setup = function () {
accepts: [ accepts: [
{arg: 'credentials', type: 'object', required: true, http: {source: 'body'}} {arg: 'credentials', type: 'object', required: true, http: {source: 'body'}}
], ],
returns: {arg: 'session', type: 'object'}, returns: {arg: 'session', type: 'object', root: true},
http: {verb: 'post'} http: {verb: 'post'}
} }
); );

View File

@ -275,7 +275,7 @@ describe('Model', function() {
{arg: 'username', type: 'string', required: true}, {arg: 'username', type: 'string', required: true},
{arg: 'password', type: 'string', required: true} {arg: 'password', type: 'string', required: true}
], ],
returns: {arg: 'sessionId', type: 'any'}, returns: {arg: 'sessionId', type: 'any', root: true},
http: {path: '/sign-in', verb: 'get'} http: {path: '/sign-in', verb: 'get'}
} }
); );
@ -292,7 +292,7 @@ describe('Model', function() {
.expect(200) .expect(200)
.end(function(err, res){ .end(function(err, res){
if(err) return done(err); if(err) return done(err);
assert(res.body.$data === 123); assert.equal(res.body, 123);
done(); done();
}); });
}); });

View File

@ -132,7 +132,7 @@ describe('User', function(){
function logout(err, sid) { function logout(err, sid) {
request(app) request(app)
.post('/users/logout') .post('/users/logout')
.expect(200) .expect(204)
.send({sid: sid}) .send({sid: sid})
.end(verify(sid, done)); .end(verify(sid, done));
} }