Again, thanks for your answers, I appreciate the help;
I have a global var 'service' to which I assign 'articlesService' in the 'beforeEach(inject ....)' block;
So technically I should be able to use 'expect(service.getAllArticles).toHaveBeenCalled() no?
Note: I tried spyOn($scope.articlesService, ...) -> spyOn could not find an object to spy upon for getAllArticles()
so I guess this won't ever work;
I can spyOn(service, ....) though
So going with that spy, which seems to do his work, doing:
expect(service.getAllArticles).toHaveBeenCalled()
throws:
Expected spy getAllArticles to have been called.
Error: Expected spy getAllArticles to have been called.
Maybe the call is done after the assertion?
In the controller:
function ($scope, articlesService) {
var self;
self = this;
$scope.articles = {
list: []
};
$scope.articles.list = articlesService.getAllArticles();
[....]