不要怂,就是干,撸起袖子干!

Commit 612f2c5d by sdepold

minor refactoring

1 parent 3ae83a8e
Showing with 19 additions and 27 deletions
...@@ -6,28 +6,27 @@ var config = require("./config/config") ...@@ -6,28 +6,27 @@ var config = require("./config/config")
, _ = Sequelize.Utils._ , _ = Sequelize.Utils._
describe('Migrator', function() { describe('Migrator', function() {
describe('getUndoneMigrations', function() { var migrator = null
var migrator = null , SequelizeMeta = null
, SequelizeMeta = null
var setup = function(_options) {
var setup = function(_options) { Helpers.async(function(done) {
Helpers.async(function(done) { var options = Sequelize.Utils._.extend({
var options = Sequelize.Utils._.extend({ path: __dirname + '/assets/migrations'
path: __dirname + '/assets/migrations' }, _options || {})
}, _options || {})
migrator = new Migrator(sequelize, options)
migrator = new Migrator(sequelize, options) migrator.findOrCreateSequelizeMetaModel({ force: true }).success(function(_SequelizeMeta) {
migrator.findOrCreateSequelizeMetaModel({ force: true }).success(function(_SequelizeMeta) { SequelizeMeta = _SequelizeMeta
SequelizeMeta = _SequelizeMeta done()
done()
})
}) })
} })
}
beforeEach(function() { migrator = null })
// specs beforeEach(function() { migrator = null })
afterEach(function() { migrator = null })
describe('getUndoneMigrations', function() {
it("returns no files if timestamps are after the files timestamp", function() { it("returns no files if timestamps are after the files timestamp", function() {
setup({ from: 20120101010101 }) setup({ from: 20120101010101 })
...@@ -72,7 +71,6 @@ describe('Migrator', function() { ...@@ -72,7 +71,6 @@ describe('Migrator', function() {
Helpers.async(function(done) { Helpers.async(function(done) {
migrator.getUndoneMigrations(function(err, migrations) { migrator.getUndoneMigrations(function(err, migrations) {
console.log(err)
expect(err).toBeFalsy() expect(err).toBeFalsy()
expect(migrations.length).toEqual(2) expect(migrations.length).toEqual(2)
done() done()
...@@ -97,14 +95,8 @@ describe('Migrator', function() { ...@@ -97,14 +95,8 @@ describe('Migrator', function() {
}) })
describe('migrate', function() { describe('migrate', function() {
var migrator = null
beforeEach(function() { beforeEach(function() {
migrator = new Migrator(sequelize, { setup({ from: 20111117063700, to: 20111117063700 })
path: __dirname + '/assets/migrations',
from: 20111117063700,
to: 20111117063700
})
Helpers.async(function(done) { Helpers.async(function(done) {
migrator.migrate().success(done).error(function(err) { console.log(err) }) migrator.migrate().success(done).error(function(err) { console.log(err) })
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!