Skip to content

Instantly share code, notes, and snippets.

@mattd
Created June 6, 2012 03:26
Show Gist options
  • Save mattd/2879698 to your computer and use it in GitHub Desktop.
Save mattd/2879698 to your computer and use it in GitHub Desktop.
define([
"spec/helpers/responses",
"collections/section"
],
function (Responses, SectionCollection) {
describe("SectionCollection", function () {
var responses;
beforeEach(function () {
responses = Responses.fetch([
{
path: "/api/users/newsfeed",
textStatus: "success",
status: 200
}
]).data;
jasmine.Ajax.useMock();
});
it(
"should be defined",
function () {
expect(SectionCollection).toBeDefined();
}
);
describe("when fetched", function () {
var collection, request;
beforeEach(function () {
collection = new SectionCollection();
collection.fetch();
request = mostRecentAjaxRequest();
request.response(responses['/api/users/newsfeed'].success);
});
it(
"should attach an AssetCollection to each of its models",
function () {
var section_one = collection.at(0);
expect(section_one.assets.length).toEqual(5);
}
);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment