backbone-generator/templates/collection_spec.js.erb

17 lines
402 B
Plaintext
Raw Normal View History

describe('<%= plural_object_name %>', function() {
2011-04-18 13:32:43 +00:00
var collection;
2011-04-15 18:55:37 +00:00
2011-04-18 13:32:43 +00:00
withServer();
2011-04-15 18:55:37 +00:00
it('should fetch records from the API', function() {
collection = new <%= plural_object_name %>();
2011-04-15 18:55:37 +00:00
2011-04-18 15:48:07 +00:00
this.server.respondWith('GET', '/<%= plural_underscore_name %>', this.validJSONResponse([{id: 1}]));
2011-04-15 18:55:37 +00:00
collection.fetch()
2011-04-18 13:32:43 +00:00
this.server.respond();
2011-04-15 18:55:37 +00:00
expect(collection.length).toEqual(1);
});
2011-04-18 13:32:43 +00:00
});