They are the real backbone of Backbone, they are the abstractions on which we build the business logic, they hold the data and are responsible for performing validations and synchronization with a remote server; they are the Backbone models.
Although we are not using Backbone on our sample application, we already have some well-defined models, both the Stock and Investment objects. But before we dig in how we could refactor them to become Backbone models, we need first to get a little bit of understanding on how they work.
To create a new model object we need first to extend it from the base Backbone model. To make matters more interesting, we are going to rewrite the entire Stock spec, by expecting the Stock to be a Backbone model.
On the Stock spec we could write the following acceptance criterion, that although not business related, guarantees that this model will inherit all of the model's functionalities:
describe("Stock", function() { var stock...