Skip to content

tests failing for "should delete the record" #3

@chrisfarms

Description

@chrisfarms

when a model is deleted from the collection it affects 'each' so the second Fruit is never destroyed. Could be argued that this is a bug in backbone, but a simple fix for the test is to copy the array first:

diff --git a/test/crud.test.js b/test/crud.test.js
index 2e0f6e7..96748ee 100644
--- a/test/crud.test.js
+++ b/test/crud.test.js
@@ -148,7 +148,7 @@ describe('CRUD', function() {
       if (x === l) return done()
     }

-    fruits.each(function(model) {
+    fruits.toArray().forEach(function(model) {
       model.destroy({
         finished: finished
       , error: function(model, resp) { done(new Error(resp)) }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions