Hi all,

I have a Controller, depending upon a service (service a), which in turn 
depends upon another service (service b).

>>Controller
>>>>ServiceA
>>>>>>ServiceB

I am writing a test (at least conceptually) at the Controller level.

I am able to introduce a mock version of Service A, something like this 
(please comment if this is bad, first of all):

var mockServiceA = ....;

beforeEach(inject(function($rootScope, $controller) {
scope = $rootScope.$new();
$controller("Controller", {
$scope: scope,
serviceA: mockServiceA 
});
}));

Anyway, the above is not what I want to do.  What I really want to mock is 
ServiceB. I just want to somehow say, "in the life of this runtime, always 
use an alternative version of ServiceB"?

What is the best way to do this?

Thank you,

PJ.

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to