title: Unit testing AngularJS factories that have dependencies
body: <p>When unit testing an Angular factory (with Karma + Jasmine), how do I inject a stub dependency into the factory under test?</p>
  
  <p>Here's my factory:</p>
  
  <pre><code>mod = angular.module('myFactoryMod', []);
  
  mod.factory('myFactory', [
    '$log', 'oneOfMyOtherServices', function($log, svc) {
      return makeSomethingThatDoesSomethingWithTheseDependencies($log, svc);
    }
  ]);
  </code></pre>
  
  <p><code>oneOfMyOtherServices</code> is needed when instantiating my factory.</p>
  
  <p>Here's my test:</p>
  
  <pre><code>it('can get an instance of my factory', function() {
    var oneOfMyOtherServicesStub;
  
    angular.mock.module('myFactoryMod');
  
    oneOfMyOtherServicesStub = {
      someVariable: 1
    };
  
    //****How do I get my stub in my target? ****
  
    angular.mock.inject(['myFactory', function(target) {
  
        expect(target).toBeDefined();
  
      }
    ]);
  })
  </code></pre>
  
  <p>N.B. I know that <code>$controller</code> allows this for controllers, but I don't see an equivalent for factories.</p>