Skip to content

Instantly share code, notes, and snippets.

@andresdominguez
Created December 3, 2016 17:24
Show Gist options
  • Save andresdominguez/4ffae0fb159324b74837335614a0cb83 to your computer and use it in GitHub Desktop.
Save andresdominguez/4ffae0fb159324b74837335614a0cb83 to your computer and use it in GitHub Desktop.
describe('User controller', () => {
let userService, userCtrl;
beforeEach(inject((_userService_, $controller) => {
userService = _userService_;
userCtrl = $controller(UserCtrl, {
user: {
name: 'Barbara'
}
});
}));
it('should update user', () => {
spyOn(userService, 'update');
userCtrl.user.name = 'Sarah';
userCtrl.save();
expect(userService.update).toHaveBeenCalled();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment