Permalink
Browse files

Get tests working again

  • Loading branch information...
1 parent e7d25a2 commit 91c76c6f2e5241bdf0d3f593285b589189d3ea54 mde committed Aug 16, 2012
Showing with 7 additions and 19 deletions.
  1. +0 −13 lib/adapters/base_adapter.js
  2. +1 −1 lib/adapters/sql/postgres.js
  3. +6 −5 test/adapters/sql/postgres.js
@@ -8,19 +8,6 @@ BaseAdapter = function () {
BaseAdapter.prototype = new EventEmitter();
utils.mixin(BaseAdapter.prototype, new (function () {
-
- this.getAppConfig = function (dbConfig) {
- var info;
- for (var p in dbConfig) {
- // Return the first alias key recognized whose
- // canonical name is the same
- info = adapter.getAdapterInfo(p);
- if (info && info.name == this.name) {
- return dbConfig[p];
- }
- }
- };
-
})());
module.exports.BaseAdapter = BaseAdapter;
@@ -25,7 +25,7 @@ Adapter = function (options) {
this.config = _baseConfig;
this.client = null;
- utils.mixin(this.config, this.getAppConfig(opts));
+ utils.mixin(this.config, opts);
this.init.apply(this, arguments);
};
@@ -28,6 +28,7 @@ tests = {
database: 'model_test'
, autoConnect: false
});
+ model.adapters.Zooby = adapter;
sql = generator.createTable(['Zooby']);
adapter.once('connect', function () {
var sql = generator.createTable(['Zooby']);
@@ -83,7 +84,7 @@ tests = {
if (err) {
throw err;
}
- assert.equal(data[0].id, currentId);
+ assert.equal(data.id, currentId);
next();
});
}
@@ -95,14 +96,14 @@ tests = {
if (err) {
throw err;
}
- assert.equal(data[0].id, currentId);
+ assert.equal(data.id, currentId);
next();
});
}
, 'test save existing': function (next) {
Zooby.load({id: currentId}, {}, function (err, data) {
- var inst = data[0];
+ var inst = data;
inst.foo = 'BAR';
inst.save(function (err, data) {
if (err) {
@@ -112,7 +113,7 @@ tests = {
if (err) {
throw err;
}
- assert.equal(data[0].foo, 'BAR');
+ assert.equal(data.foo, 'BAR');
next();
});
});
@@ -128,7 +129,7 @@ tests = {
if (err) {
throw err;
}
- assert.equal(data.length, 0);
+ assert.ok(!data);
next();
});
});

0 comments on commit 91c76c6

Please sign in to comment.