2011-04-15 20:02:22 +00:00
|
|
|
describe('<%= object_name %>s', function() {
|
2011-04-15 18:55:37 +00:00
|
|
|
var collection, server;
|
|
|
|
|
|
|
|
beforeEach(function() {
|
|
|
|
server = sinon.fakeServer().create();
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(function() {
|
|
|
|
server.restore();
|
|
|
|
});
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
server.respondWith('GET', '<%= underscore_name %>', [ 200, { 'Content-type': 'application/json' }, "[{id: 1}]" ]);
|
|
|
|
collection.fetch()
|
|
|
|
server.respond();
|
|
|
|
|
|
|
|
expect(collection.length).toEqual(1);
|
|
|
|
});
|
2011-04-15 19:02:36 +00:00
|
|
|
}s);
|