2014-02-21 23:03:45 +00:00
|
|
|
var loopback = require('../');
|
2014-05-03 01:12:24 +00:00
|
|
|
var defineModelTestsWithDataSource = require('./util/model-tests');
|
2014-02-21 23:03:45 +00:00
|
|
|
|
|
|
|
describe('RemoteConnector', function() {
|
2014-05-03 01:12:24 +00:00
|
|
|
var remoteApp;
|
|
|
|
var remote;
|
2014-02-21 23:03:45 +00:00
|
|
|
|
2014-05-03 01:12:24 +00:00
|
|
|
defineModelTestsWithDataSource({
|
|
|
|
beforeEach: function(done) {
|
|
|
|
var test = this;
|
|
|
|
remoteApp = loopback();
|
|
|
|
remoteApp.use(loopback.logger('dev'));
|
|
|
|
remoteApp.use(loopback.rest());
|
|
|
|
remoteApp.listen(0, function() {
|
|
|
|
test.dataSource = loopback.createDataSource({
|
|
|
|
host: remoteApp.get('host'),
|
|
|
|
port: remoteApp.get('port'),
|
|
|
|
connector: loopback.Remote
|
|
|
|
});
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
onDefine: function(Model) {
|
|
|
|
var RemoteModel = Model.extend(Model.modelName);
|
|
|
|
RemoteModel.attachTo(loopback.memory());
|
|
|
|
remoteApp.model(RemoteModel);
|
|
|
|
}
|
2014-04-14 21:17:56 +00:00
|
|
|
});
|
2014-02-21 23:03:45 +00:00
|
|
|
});
|