title: How to resolve promises in AngularJS, Jasmine 2.0 when there is no $scope to force a digest?
body: <p>It seems that promises <a href="https://stackoverflow.com/questions/16316940/how-to-resolve-q-all-promises-in-jasmine-unit-tests">do not resolve in Angular/Jasmine tests unless you force a <code>$scope.$digest()</code></a>.  This is silly IMO but fine, I have that working where applicable (controllers).</p>
  
  <p>The situation I'm in now is I have a service which could care less about any scopes in the application, all it does it return some data from the server but the promise doesn't seem to be resolving.</p>
  
  <pre><code>app.service('myService', function($q) {
    return {
      getSomething: function() {
        var deferred = $q.defer();
        deferred.resolve('test');
        return deferred.promise;
      }
    }
  });
  </code></pre>
  
  <hr>
  
  <pre><code>describe('Method: getSomething', function() {
    // In this case the expect()s are never executed
    it('should get something', function(done) {
      var promise = myService.getSomething();
  
      promise.then(function(resp) {
        expect(resp).toBe('test');      
        expect(1).toEqual(2);
      });
  
      done();
    });
  
    // This throws an error because done() is never called.
    // Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
    it('should get something', function(done) {
      var promise = myService.getSomething();
  
      promise.then(function(resp) {
        expect(resp).toBe('test');      
        expect(1).toEqual(2);
        done();
      });
    });
  });
  </code></pre>
  
  <p>What is the correct way to test this functionality?</p>
  
  <p><strong>Edit: Solution for reference.  Apparently you are forced to inject and digest the $rootScope even if the service is not using it.</strong></p>
  
  <pre><code>  it('should get something', function($rootScope, done) {
      var promise = myService.getSomething();
  
      promise.then(function(resp) {
        expect(resp).toBe('test');      
      });
  
      $rootScope.$digest();
      done();
    }); 
  </code></pre>