title: Error: No more request expected with Karma using Restangular from within a Service
body: <p>I have an AngularJS service and service name is User. I use it for authentication. Inside this service, I have an authenticate() function which uses Restangular to make a REST call to our API. It's perfectly working in my Angular application. I just started using karma so I can including testing. I'm wondering why I'm getting this error. Also, I've read few stackoverflow post and noticed that they use $httpBackend directly on their spec file. Unfortunately, it's different from my setup.</p>
  
  <pre><code>INFO [watcher]: Changed file "/Users/admin/repos/acme/acme-ui/test/spec/controllers/main.js".
  Chrome 41.0.2272 (Mac OS X 10.8.3) App: CockpitApplication factory: GlobalPermissionsFactory should resolve status to 200 FAILED
      Error: Unexpected request: POST https://someinternaldomain.com/v1/authentokens
      No more request expected
          at $httpBackend (/Users/admin/repos/acme/acme-ui/app/bower_components/angular-mocks/angular-mocks.js:1224:9)
          at sendReq (/Users/admin/repos/acme/acme-ui/app/bower_components/angular/angular.js:9538:9)
          at serverRequest (/Users/admin/repos/acme/acme-ui/app/bower_components/angular/angular.js:9255:16)
          at processQueue (/Users/admin/repos/acme/acme-ui/app/bower_components/angular/angular.js:13075:27)
          at /Users/admin/repos/acme/acme-ui/app/bower_components/angular/angular.js:13091:27
          at Scope.$eval (/Users/admin/repos/acme/acme-ui/app/bower_components/angular/angular.js:14291:28)
          at Scope.$digest (/Users/admin/repos/acme/acme-ui/app/bower_components/angular/angular.js:14107:31)
          at Object.&lt;anonymous&gt; (/Users/admin/repos/acme/acme-ui/test/spec/controllers/main.js:71:24)
  Firefox 34.0.0 (Mac OS X 10.8) App: CockpitApplication factory: GlobalPermissionsFactory should resolve status to 200 FAILED
      Error: Unexpected request: POST https://someinternaldomain/v1/authentokens
      No more request expected in /Users/admin/repos/acme/acme-ui/app/bower_components/angular-mocks/angular-mocks.js (line 1224)
      $httpBackend@/Users/admin/repos/acme/acme-ui/app/bower_components/angular-mocks/angular-mocks.js:1224:1
      sendReq@/Users/admin/repos/acme/acme-ui/app/bower_components/angular/angular.js:9538:1
      $http/serverRequest@/Users/admin/repos/acme/acme-ui/app/bower_components/angular/angular.js:9255:16
      processQueue@/Users/admin/repos/acme/acme-ui/app/bower_components/angular/angular.js:13075:27
      scheduleProcessQueue/&lt;@/Users/admin/repos/acme/acme-ui/app/bower_components/angular/angular.js:13091:27
      $RootScopeProvider/this.$get&lt;/Scope.prototype.$eval@/Users/admin/repos/acme/acme-ui/app/bower_components/angular/angular.js:14291:16
      $RootScopeProvider/this.$get&lt;/Scope.prototype.$digest@/Users/admin/repos/acme/acme-ui/app/bower_components/angular/angular.js:14107:15
      @/Users/admin/repos/acme/acme-ui/test/spec/controllers/main.js:71:13
  Chrome 41.0.2272 (Mac OS X 10.8.3): Executed 4 of 4 (1 FAILED) (0.114 secs / 0.111 secs)
  Firefox 34.0.0 (Mac OS X 10.8): Executed 4 of 4 (1 FAILED) (0.101 secs / 0.092 secs)
  TOTAL: 2 FAILED, 6 SUCCESS
  </code></pre>
  
  <p>and here is my main.js, the Karma spec file</p>
  
  <pre><code>describe('App: CockpitApplication', function () {
  
    // load the controller's module
      beforeEach(module('CockpitApplication'));
  
      var $controller, $q, $rootScope;
      beforeEach(inject(function(_$controller_, _$q_, _$rootScope_) {
          $controller = _$controller_;
          $q = _$q_;
          $rootScope = _$rootScope_;
      }));
  
      describe('factory: GlobalPermissionsFactory', function() {
          var _GlobalPermissionsFactory = null,
              _UserInformationFactory = null,
              _User = null;
  
          beforeEach(inject(function(GlobalPermissionsFactory) {
              _GlobalPermissionsFactory = GlobalPermissionsFactory;
          }));
  
          beforeEach(inject(function(UserInformationFactory) {
              _UserInformationFactory = UserInformationFactory;
          }));
  
          beforeEach(inject(function(User) {
              _User = User;
          }));
  
          it('should return false', function() {
              expect(_GlobalPermissionsFactory).toBeDefined()
          });
  
          it('should check if getUserInformation() exists', function() {
              expect(_UserInformationFactory.getUserInformation).toBeDefined()
          });
  
          it('should return a promise', function() {
              expect(_User.authenticate('admin', 'secret').then).toBeDefined();
          });
  
          it('should resolve status to 200', function () {
              var data;
  
              // set up a deferred
              var deferred = $q.defer();
              // get promise reference
              var promise = deferred.promise;
  
              // set up promise resolve callback
              promise.then(function (response) {
                  console.log('data',data);
                  data = response.status;
              });
  
              _User.authenticate('admin', 'secret').then(function(response) {
                  // resolve our deferred with the response when it returns
                  deferred.resolve(response);
              });
  
              // force `$digest` to resolve/reject deferreds
              $rootScope.$digest();
  
              // make your actual test
              expect(data).toEqual(200);
  
          });
      });
  });
  </code></pre>