If Comment is a service I would mock it like this instead:
CommentMock = {}
CommentMock.save = function() {
// stuff
};
spyOn( CommentMock, 'save' ).andCallThrough();
But actually I wouldnt mock it like this at all. I would allow the service to be injected into the unit test and then intercept the service call using the spyOn method of jasmine.
var Comment, $rootScope, $controller; //... maybe more...
beforeEach(inject(function(_$rootScope_, _Comment_, _$controller_ //,... everything else) {
$controller = _$controller_;
$rootScope = _$rootScope_;
Comment = _Comment_;
}));
function setupController() {
spyOn(Comment, 'save').andCallThrough();
controller = $controller('YOURCONTROLLERSNAME', {
$scope: $scope,
Comment: Comment
}
}
Code is super simplified and wont work straight like this but its the overall idea...
Some other unit testing links I wrote:
Mocking Controller Instantiation In Angular Directive Unit Test