Create and Update were returning the models toJson function. This is not always the same as what is stored in local storage (which is written using JSON.stringify(model)). This results in the parse method receiving different values depending on what method is called.
Create & Update should return same result as read
Create and Update were returning the models toJson function. This is
not always the same as what is stored in local storage. This results in
the parse method receiving different values depending on what method is
Why not return model? (real question, I've been out of the game a bit, not sure what's the advantage of fetching the model again)
From what I understand update/create/read sync methods all get their response passed to the parse method. This method expects (based on the documentation) the raw response from the server. So the change I put in here standardizes those responses.
The reason I found this is because I have a collection as an attribute for a model. When this model gets written to local storage the json stringfy converts the collection into an array. When I retrieve that model again I need to parse the result and re-create that collection.
This could be done by calling stringify on the model like when it saves, but I figured just calling find to get would suffice.
Mega test refactor, now using Mocha. Some tests were utterly useless …
…as they tested Backbone functionalities. Fixes #34