diff --git a/docs/content/guide/unit-testing.ngdoc b/docs/content/guide/unit-testing.ngdoc index 63f1b8667da4..cc689a23473b 100644 --- a/docs/content/guide/unit-testing.ngdoc +++ b/docs/content/guide/unit-testing.ngdoc @@ -149,16 +149,17 @@ for instantiating controllers. describe('PasswordController', function() { beforeEach(module('app')); - var $controller; + var $controller, $rootScope; - beforeEach(inject(function(_$controller_){ + beforeEach(inject(function(_$controller_, _$rootScope_){ // The injector unwraps the underscores (_) from around the parameter names when matching $controller = _$controller_; + $rootScope = _$rootScope_; })); describe('$scope.grade', function() { it('sets the strength to "strong" if the password length is >8 chars', function() { - var $scope = {}; + var $scope = $rootScope.$new(); var controller = $controller('PasswordController', { $scope: $scope }); $scope.password = 'longerthaneightchars'; $scope.grade();