Skip to content

Commit

Permalink
Moves db.load() test to new framework
Browse files Browse the repository at this point in the history
  • Loading branch information
dresende committed Jul 11, 2013
1 parent d848761 commit 0168039
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 0 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 25 additions & 0 deletions test/integration2/db.js
Expand Up @@ -29,3 +29,28 @@ describe("db.define()", function() {
return done();
});
});

describe("db.load()", function () {
var db = null;

before(function (done) {
helper.connect(function (connection) {
db = connection;

return done();
});
});

after(function () {
return db.close();
});

it("should require a file based on relative path", function (done) {
db.load("../support/spec_load", function () {
db.models.should.have.property("person");
db.models.should.have.property("pet");

return done();
});
});
});
7 changes: 7 additions & 0 deletions test/support/spec_load.js
@@ -0,0 +1,7 @@
module.exports = function (db, cb) {
db.define("person", {
name : String
});

return db.load("./spec_load_second", cb);
};
9 changes: 9 additions & 0 deletions test/support/spec_load_second.js
@@ -0,0 +1,9 @@
module.exports = function (db, cb) {
db.define("pet", {
name : String
});

setTimeout(function () {
return cb();
}, 200);
};

0 comments on commit 0168039

Please sign in to comment.