Skip to content

Instantly share code, notes, and snippets.

@AlexZeitler
Created May 25, 2015 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexZeitler/ee487a392b363f0a0b26 to your computer and use it in GitHub Desktop.
Save AlexZeitler/ee487a392b363f0a0b26 to your computer and use it in GitHub Desktop.
$httpBackend + promise
describe('when getting configuration from backend', function () {
beforeEach(inject(function ($injector) {
$httpBackend = $injector.get("$httpBackend");
$httpBackend.expect("GET", "/api/config")
.respond(200, configMock);
}));
afterEach(function () {
$httpBackend.flush();
$httpBackend.verifyNoOutstandingExpectation();
$httpBackend.verifyNoOutstandingRequest();
});
it('should read configuration', inject(function (configurationService) {
configurationService.getConfiguration().then(function(configuration) {
expect(configuration).toEqual(configMock);
})
}));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment