I'm trying to inject a service into my controllers unit test. I'm not looking to make a mock out of the service but just include it so that I can have access to all of its methods. Is this possible?
'use strict';
describe('Offers : controller', function(){
beforeEach(module('client'));
var $scope,
controller,
$rootScope,
genericService;
beforeEach(inject(function($injector, $controller) {
$rootScope = $injector.get('$rootScope');
controller = $controller('OffersCtrl', { $scope: $scope });
genericService = $injector.get('genericService');
$scope = $rootScope.$new();
}));
it('should have a genericService', function () {
expect(genericService.method).toBeDefined();
});
});
Aucun commentaire:
Enregistrer un commentaire