Skip to content

Instantly share code, notes, and snippets.

@chris-ramon
Created March 8, 2014 16:55
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 chris-ramon/9434921 to your computer and use it in GitHub Desktop.
Save chris-ramon/9434921 to your computer and use it in GitHub Desktop.
angularjs testing
// mock service, override methods
EmployeeService = $injector.get('EmployeeService');
spyOn(EmployeeService, 'getAllUrl')
.andReturn('http://0.0.0.0:3000/1/employees');
// mock service, replace
mockEmployeeService = {
getAll: function() {
return employees;
}
}
$controller('EmployeeListCtrl', {$scope: scope,
EmployeeService: mockEmployeeService});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment