Permalink
Browse files

added another removal test

  • Loading branch information...
1 parent fa4c8a4 commit 1643f87df0154c7f2d688a42a8ca341a6b26c01f @brenden brenden committed with Ryan Fitzgerald Mar 15, 2012
Showing with 15 additions and 6 deletions.
  1. +14 −5 test/resourceful-mongo-test.js
  2. +1 −1 test/test-helper.js
@@ -100,7 +100,6 @@ describe("Updating", function() {
});
});
});
-
});
describe("Finding", function(){
@@ -130,7 +129,6 @@ describe("Finding", function(){
done();
});
-
});
});
@@ -145,9 +143,7 @@ describe("Finding", function(){
done();
});
});
-
});
-
});
describe("Destroying", function() {
@@ -156,8 +152,21 @@ describe("Destroying", function() {
done();
});
});
-
+
it("by id", function(done) {
+
+ db.Person.create(db.people.bob, function(err, bob) {
+ db.Person.destroy(bob.id, function(err, result) {
+
+ if(err) done(err);
+
+ result.should.equal(1);
+ done();
+ });
+ });
+ });
+
+ it("by name", function(done) {
db.Person.destroy({name: "bob"}, function(err, result) {
if(err) done(err);
View
@@ -37,7 +37,7 @@ DB.createPerson = function(person, callback) {
DB.drop = function(callback) {
- this.timeout(10000);
+ this.timeout(10000); //The tests are a bit slow because the database is dropped before each one.
if (!DB.Person.connection.connection) return callback();

0 comments on commit 1643f87

Please sign in to comment.