最初beforeEach
は User コレクションをクリアします...これは、最初の一連のテスト (#save() describe) では正常に機能しますが、2 番目の describe("#find()") では機能しません。
describe('User', function(){
beforeEach(function(done){
//clear out db
User.remove(done);
});
describe('#save()', function(){
beforeEach(function(done){
user = new User(fakeUser);
done();
});
it('should have username property', function(done){
});
it('should not save if username is not present', function(done){
});
});
describe('#find()', function(){
beforeEach(function(done){
user = new User(fakeUser);
user.save(function(err, user){
done();
});
});
it('should find user by email', function(done){
});
it('should find user by username', function(done){
});
});
});
最初のbeforeEac
h は何を指していますか? 子供ごとに実行されると思っていましdescribe
たが、どうやらそうではありません。