2013-04-07 21:53:55 +00:00
|
|
|
module.exports = require('should');
|
|
|
|
|
2013-07-30 21:21:10 +00:00
|
|
|
var Schema = require('loopback-datasource-juggler').Schema;
|
2013-03-27 00:37:13 +00:00
|
|
|
|
2013-07-22 00:27:54 +00:00
|
|
|
global.getConfig = function(options) {
|
|
|
|
|
|
|
|
var dbConf = {
|
2013-07-21 05:37:59 +00:00
|
|
|
host: '127.0.0.1',
|
|
|
|
port: 3306,
|
2013-07-22 00:27:54 +00:00
|
|
|
database: 'myapp_test',
|
2013-07-21 05:37:59 +00:00
|
|
|
username: 'strongloop',
|
|
|
|
password: 'password'
|
2013-07-22 00:27:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if (options) {
|
|
|
|
for (var el in options) {
|
|
|
|
dbConf[el] = options[el]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return dbConf;
|
|
|
|
}
|
|
|
|
|
|
|
|
global.getSchema = function(options) {
|
|
|
|
var db = new Schema(require('../'), getConfig(options));
|
2013-03-27 00:37:13 +00:00
|
|
|
return db;
|
|
|
|
};
|
2013-07-22 00:27:54 +00:00
|
|
|
|
|
|
|
|