   describe 'db:migrate', ->
     it 'should be able to run a migration', (done)->
       @tableName = 'one_migration'
-      migrateScope(@adapter, migrationsPath, @tableName, (err)=>
+      migrateScope(@adapter, migrationsPath, @tableName, (err, versions)=>
         return done(err) if err
         CustomAssertions.assertTableColumnCount(@AdapterWrapper, @tableName, 3, done)
+        assert.equal(versions.length, 1)
       )
 
     it 'should be able to run 2 migrations', (done)->
       @tableName = 'two_migrations'
-      migrateScope(@adapter, migrationsPath, @tableName, (err)=>
+      migrateScope(@adapter, migrationsPath, @tableName, (err, versions)=>
         return done(err) if err
         CustomAssertions.assertTableColumnCount(@AdapterWrapper, @tableName, 4, done)
+        assert.equal(versions.length, 2)
       )
-
-    afterEach (done)->
-      @AdapterWrapper.drop(@tableName, done)
 
   describe 'db:rollback', ->
     it 'should rollback one migration', (done)->
       @tableName = 'one_migration'
-      rollbackScope(@adapter, migrationsPath, @tableName, (err)=>
+      rollbackScope(@adapter, migrationsPath, @tableName, (err, versions)=>
         return done(err) if err
         CustomAssertions.assertTableColumnCount(@AdapterWrapper, @tableName, 0, done)
+        assert.equal(versions.length, 0)
       )
 
     it 'should rollback once with two migrations', (done)->
       @tableName = 'two_migrations'
-      rollbackScope(@adapter, migrationsPath, @tableName, (err)=>
+      rollbackScope(@adapter, migrationsPath, @tableName, (err, versions)=>
         return done(err) if err
         CustomAssertions.assertTableColumnCount(@AdapterWrapper, @tableName, 3, done)
+        assert.equal(versions.length, 1)
       )
 
-    afterEach (done)->
-      @AdapterWrapper.drop(@tableName, done)
+  afterEach (done)->
+    @AdapterWrapper.drop(@tableName, done)

rmdirp = require('../helpers/rmdirp.coffee')
GeneralHelper = require("../helpers/general.coffee")
CustomAssertions = require("../helpers/custom_assertions.coffee")

Migrator = rek("lib/sails-migrations/migrator.coffee")
AdapterWrapper = rek("lib/sails-migrations/adapter_wrapper.coffee")

# Runs migration on the migration files that include provided name (scope)
migrateScope = (adapter, migrationsPath, scope, cb)->
  copyFixturesToMigrationsPath(scope)
  Migrator.migrate(adapter, migrationsPath, null, (err)=>
    return cb(err) if err
    SchemaMigration.getAllVersions(adapter, cb)
  )

# Runs rollback on the migration files that include provided name (scope)
rollbackScope = (adapter, migrationsPath, scope, cb)->
  migrateScope(adapter, migrationsPath, scope, (err)=>
    return cb(err) if err
    Migrator.rollback(adapter, migrationsPath, null, (err)=>
      return cb(err) if err
      SchemaMigration.getAllVersions(adapter, cb)
    )
  )

describe 'migration', ->
