title: Injecting dependent services when unit testing AngularJS services
body: <p>I'm testing service A, but service A depends on service B (i.e. service B is injected into service A).</p>
  
  <p>I've seen <a href="https://stackoverflow.com/q/10551986/295797">this question</a> but my case is a bit different because in my opinion it makes more sense to <em>mock</em> service B instead of injecting an actual instance of service B.  I'd mock it with a jasmine spy.</p>
  
  <p>Here's a sample test:</p>
  
  <pre><code>describe("Sample Test Suite", function() {
  
    beforeEach(function() {
  
      module('moduleThatContainsServiceA');
  
      inject([
        'serviceA', function(service) {
          this.service = service;
        }
      ]);
  
    });
  
    it('can create an instance of the service', function() {
      expect(this.service).toBeDefined();
    });
  });
  </code></pre>
  
  <p>The error I get is:</p>
  
  <blockquote>
    <p>Error: Unknown provider: serviceBProvider</p>
  </blockquote>
  
  <p>How could I do something like this?</p>