Imagine a scenario where there is a service in my application that relies on a value stored in $rootScope. The example below shows a simple service that does this:
angular.module('myServices', [])
.factory('rootValGetterService', function($rootScope) {
return {
getVal: function () {
return $rootScope.specialValue;
}
};
});
In order to unit test this service by setting a value in $rootScope, what would be the most effective approach to take?