Skip to content
Snippets Groups Projects
Commit a636c1bf authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Create nodejs script to load the test database.

parent 26a9370d
No related branches found
No related tags found
No related merge requests found
......@@ -17,9 +17,7 @@ end
desc "Run Jasmine specs for comments backend"
task :jasmine do
# Initialize database with test data
test_db = "comments_test"
system("mysql #{test_db} < comments/sql/schema.sql")
system("mysql #{test_db} < comments/sql/test_data.sql")
system("cd comments/; node load_test_db.js")
# run jasmine tests against that database
system("node comments/node_modules/jasmine-node/lib/jasmine-node/cli.js comments/spec/")
......
var config = require("./config.js");
var exec = require('child_process').exec;
// Load database connection config
var db = config.testDb.database;
var user = config.testDb.user ? " -u "+config.testDb.user : "";
var pass = config.testDb.password ? " -p"+config.testDb.password : "";
var cmd = "mysql " + db + user + pass;
// Initialize database with test data
exec(cmd+" < sql/schema.sql", function(err){
if (err) console.log(err);
exec(cmd+" < sql/test_data.sql", function(err){
if (err) console.log(err);
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment