Skip to content

Instantly share code, notes, and snippets.

@allensb
Created May 6, 2015 02:31
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 allensb/141858106aad6655adae to your computer and use it in GitHub Desktop.
Save allensb/141858106aad6655adae to your computer and use it in GitHub Desktop.
it("should make an ajax call to api/students", function () {
httpBackend.expectGET('app/views/home/home.html').respond(200);
httpBackend.whenGET("http://localhost:7000/api/student/1").respond(200, {
id: 7, // Data returned, but not set in scope
first: 'Chris',
last: 'Johnson'
});
controller("UpdateCtrl", {$scope: scope, studentApi: service, $routeParams: {id: 1}});
httpBackend.flush();
expect(scope.first).toBe('Chris');
expect(scope.last).toBe('Johnson');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment