spec/javascripts/backbone-nested-attributes/ModelSpec.js in backbone-nested-attributes-0.3.0 vs spec/javascripts/backbone-nested-attributes/ModelSpec.js in backbone-nested-attributes-0.3.2
- old
+ new
@@ -209,10 +209,26 @@
expect(changedModel).toBeUndefined()
})
})
})
+ describe("when synchronizing", function() {
+ beforeEach(function() {
+ jasmine.Ajax.useMock()
+
+ model = new Post({ title: 'Some Title', author: { name: 'Jon Snow' } })
+ model.url = 'http://someapi.com'
+ })
+
+ it("does not raise errors", function() {
+ model.save()
+
+ var request = mostRecentAjaxRequest();
+ request.response({status: 200, responseText: { title: 'Some Title', comments: [] }}) // would raise error
+ })
+ })
+
describe("toJSON", function() {
beforeEach(function() {
model = new Post({ title: 'Some Title', author: { name: 'Jon Snow' } })
})
@@ -695,6 +711,6 @@
})
})
})
})
})
-})
\ No newline at end of file
+})