Created
June 6, 2012 03:26
-
-
Save mattd/2879698 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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