Refine the usage of rc

This commit is contained in:
Raymond Feng 2013-08-23 14:31:43 -07:00
parent 2b20ccdbd7
commit 9276025bc6
5 changed files with 12 additions and 21 deletions

View File

@ -3,8 +3,7 @@ config = (config.test && config.test.mysql) || {};
var DataSource = require('loopback-datasource-juggler').DataSource;
var config = require('rc')('loopback');
config = (config.dev && config.dev.mysql) || {};
var config = require('rc')('loopback', {dev: {mysql: {}}}).dev.mysql;
var ds = new DataSource(require('../'), config);

View File

@ -1,17 +1,14 @@
var should = require('./init.js');
require('./init.js');
var assert = require('assert');
var Schema = require('loopback-datasource-juggler').Schema;
var db, settings, adapter, DummyModel, odb;
var db, DummyModel, odb;
describe('migrations', function() {
before(function() {
require('./init.js');
odb = getSchema({collation: 'utf8_general_ci'});
odb = getDataSource({collation: 'utf8_general_ci'});
db = odb;
});

View File

@ -1,8 +1,7 @@
var should = require('./init.js');
require('./init.js');
var assert = require('assert');
var Schema = require('loopback-datasource-juggler').Schema;
var db, settings, adapter, EnumModel, ANIMAL_ENUM;
var db, EnumModel, ANIMAL_ENUM;
describe('MySQL specific datatypes', function() {

View File

@ -2,8 +2,7 @@ module.exports = require('should');
var DataSource = require('loopback-datasource-juggler').DataSource;
var config = require('rc')('loopback');
config = (config.test && config.test.mysql) || {};
var config = require('rc')('loopback', {test: {mysql: {}}}).test.mysql;
global.getConfig = function(options) {
@ -17,14 +16,14 @@ global.getConfig = function(options) {
if (options) {
for (var el in options) {
dbConf[el] = options[el]
dbConf[el] = options[el];
}
}
return dbConf;
}
};
global.getSchema = function(options) {
global.getDataSource = global.getSchema = function(options) {
var db = new DataSource(require('../'), getConfig(options));
return db;
};

View File

@ -6,11 +6,8 @@ var DataSource = require('loopback-datasource-juggler').DataSource;
var db;
before(function() {
var config = require('rc')('loopback');
config = (config.dev && config.dev.mysql) || {};
var config = require('rc')('loopback', {dev: {mysql: {}}}).dev.mysql;
db = new DataSource(require('../'), config);
});
describe('discoverModels', function() {