Merge pull request #224 from strongloop/feature/fix-issue-97

Add an intergration test for belongsTo remoting
This commit is contained in:
Raymond Feng 2014-04-07 08:35:19 -07:00
commit 2c23a57b11
2 changed files with 28 additions and 1 deletions

View File

@ -30,7 +30,15 @@
"widget": {
"properties": {},
"public": true,
"dataSource": "db"
"dataSource": "db",
"options": {
"relations": {
"store": {
"model": "store",
"type": "belongsTo"
}
}
}
},
"store": {
"properties": {},

View File

@ -96,6 +96,25 @@ describe('relations - integration', function () {
});
});
describe('/widgets/:id/store', function () {
beforeEach(function (done) {
var self = this;
this.store.widgets.create({
name: this.widgetName
}, function(err, widget) {
self.widget = widget;
self.url = '/api/widgets/' + self.widget.id + '/store';
done();
});
});
lt.describe.whenCalledRemotely('GET', '/api/widgets/:id/store', function () {
it('should succeed with statusCode 200', function () {
assert.equal(this.res.statusCode, 200);
assert.equal(this.res.body.id, this.store.id);
});
});
});
describe('hasAndBelongsToMany', function() {
beforeEach(function defineProductAndCategoryModels() {
var product = app.model(