-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
model.resors can now be a (Mongoose)Resors instance, not just it's op…
…tions hash.
- Loading branch information
etai
committed
Jul 3, 2013
1 parent
eafbb2e
commit 07c4640
Showing
4 changed files
with
22 additions
and
26 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,18 @@ | ||
var testCase = require('nodeunit').testCase; | ||
|
||
var mongoose = require('mongoose'), | ||
express = require('express'), | ||
Resors = require('../'), | ||
MongooseResors = Resors.MongooseResors; | ||
|
||
// mongoose | ||
mongoose.connect('mongodb://localhost/resors-test'); | ||
var users = mongoose.model('users', { | ||
var User = mongoose.model('users', { | ||
name: { type: String, required: true }, | ||
email: String | ||
}); | ||
users.create({ name: 'Paul' }); | ||
|
||
// tests | ||
module.exports = testCase({ | ||
"0": function (test) { | ||
test.ok(true); | ||
test.done(); | ||
}, | ||
|
||
"simple mongoose model": function(test) { | ||
var app = express(); | ||
var r = new MongooseResors(users, users.resors); | ||
r.routes(app); | ||
test.done(); | ||
} | ||
}); | ||
// test | ||
var app = express(); | ||
var r = new MongooseResors(User, User.resors); | ||
r.routes(app); | ||
console.log(r instanceof MongooseResors); | ||
console.log(r instanceof Resors); |