Created
July 8, 2013 14:05
-
-
Save mikermcneil/5949086 to your computer and use it in GitHub Desktop.
bootstrap.js :: unit test demo for Sails v0.9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Bootstrap | |
*/ | |
var Sails = require('sails'), | |
Utils = require('./utils'), | |
Database = require('./database'), | |
localConf = require('../../config/local'); | |
/** | |
* Before ALL the test bootstrap the server | |
*/ | |
var app; | |
before(function(done) { | |
this.timeout(5000); | |
// Create the Database | |
Database.createDatabase(function() { | |
Sails.lift({ | |
log: { | |
level: 'error' | |
}, | |
adapters: { | |
mysql: { | |
module: 'sails-mysql', | |
host: 'localhost', | |
database: 'name_of_your_database', | |
user: 'root', | |
pass: localConf.MYSQL && localConf.MYSQL.PASS || '' | |
} | |
} | |
}, function(err, sails) { | |
app = sails; | |
done(err, sails); | |
}); | |
}); | |
}); | |
/** | |
* After ALL the tests, lower sails | |
*/ | |
after(function(done) { | |
// Remove Testing footprints | |
Database.dropDatabase(function() { | |
app.lower(done); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment