Skip to content

Commit

Permalink
Make sure test closes db and tests don't hang
Browse files Browse the repository at this point in the history
Style corrections, 85 cols limit
  • Loading branch information
rauchg committed Feb 9, 2011
1 parent 04dfb2f commit 338a3ee
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions test/model.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ BlogPost.virtual('titleWithAuthor')
this.set('author', split[1]);
});


BlogPost.method('cool', function(){
return this;
});
Expand Down Expand Up @@ -871,19 +870,28 @@ module.exports = {
},

'test getters with same name on embedded documents not clashing': function() {
var Post = new Schema(
{ title : String
, author : { name : String }
, subject : { name: String }
});
mongoose.model('PostWithSubGetters', Post);
var Post = new Schema({
title : String
, author : { name : String }
, subject : { name : String }
});

mongoose.model('PostWithClashGetters', Post);

var db = start()
, PostModel = db.model('PostWithSubGetters', 'postwithsubgetters' + random())
, model = new PostModel({title: "Test", author: {name: "A"}, subject: {name: "B"}});
, PostModel = db.model('PostWithClashGetters', 'postwithclash' + random());

model.author.name.should.eql("A");
model.subject.name.should.eql("B");
model.author.name.should.eql("A");
var post = new PostModel({
title: 'Test'
, author: { name: 'A'}
, subject: {name: 'B'}
});

post.author.name.should.eql('A');
post.subject.name.should.eql('B');
post.author.name.should.eql('A');

db.close();
},

'test middleware': function () {
Expand Down

0 comments on commit 338a3ee

Please sign in to comment.