Migration-friendly tests

This commit is contained in:
Anatoliy Chakkaev 2013-03-27 04:50:34 +04:00
parent 2749a1f7e0
commit ffdfac30e1
2 changed files with 9 additions and 5 deletions

View File

@ -2,7 +2,7 @@ var db, User, should = require('should');
describe('basic-querying', function() { describe('basic-querying', function() {
before(function() { before(function(done) {
db = getSchema(); db = getSchema();
User = db.define('User', { User = db.define('User', {
@ -12,6 +12,8 @@ describe('basic-querying', function() {
order: {type: Number, index: true} order: {type: Number, index: true}
}); });
db.automigrate(done);
}); });
@ -193,7 +195,7 @@ describe('basic-querying', function() {
User.exists(u.id, function(err, exists) { User.exists(u.id, function(err, exists) {
should.not.exist(err); should.not.exist(err);
should.exist(exists); should.exist(exists);
exists.should.be.true; exists.should.be.ok;
done(); done();
}); });
}); });
@ -203,7 +205,7 @@ describe('basic-querying', function() {
User.destroyAll(function() { User.destroyAll(function() {
User.exists(42, function(err, exists) { User.exists(42, function(err, exists) {
should.not.exist(err); should.not.exist(err);
exists.should.be.false; exists.should.not.be.ok;
done(); done();
}); });
}); });

View File

@ -8,15 +8,17 @@ var j = require('../'),
describe('hooks', function() { describe('hooks', function() {
before(function() { before(function(done) {
db = getSchema(); db = getSchema();
User = db.define('User', { User = db.define('User', {
email: String, email: {type: String, index: true},
name: String, name: String,
password: String, password: String,
state: String state: String
}); });
db.automigrate(done);
}); });
describe('initialize', function() { describe('initialize', function() {