backbone-generator/templates/collection_spec.js.erb

17 lines
382 B
Plaintext
Raw Normal View History

2011-04-15 20:02:22 +00:00
describe('<%= object_name %>s', 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() {
2011-04-15 20:02:22 +00:00
collection = new <%= object_name %>s();
2011-04-15 18:55:37 +00:00
2011-04-18 13:32:43 +00:00
this.server.respondWith('GET', '<%= 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
});