Created
January 12, 2014 14:34
-
-
Save dbouwman/8385293 to your computer and use it in GitHub Desktop.
Using a mock to test the full fetch method, without a server
This file contains 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
describe('loads itself from the service', function () { | |
beforeEach(function() { | |
json = getJSONFixture('entities/Dataset/dataset.json'); | |
var response = { | |
status: 200, | |
responseText: JSON.stringify(json) | |
}; | |
jasmine.Ajax.useMock(); | |
model = new Composer.Models.Dataset({id:json.data.id}); | |
model.fetch(); | |
var request = mostRecentAjaxRequest(); | |
request.response(response); | |
}); | |
it('sets the version', function() { | |
expect(model.get('current_version')).toEqual(json.data.current_version); | |
}); | |
//lots more tests removed for brevity | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment