title: Angular and Jasmine: How to test requestError / rejection in HTTP interceptor?
body: <p>How would you test this <code>requestError</code> method?</p>
  
  <pre><code>angular.module('myApp').factory 'HTTPInterceptor', [
    '$rootScope'
    '$q'
    '$window'
    'LocalStorageService'
    '$injector'
    ($rootScope, $q, $window, $injector) -&gt;
      {
  
    request: (config) -&gt;
      config.headers = config.headers or {}
      // do stuff with config then
      config # Return Config
  
    requestError: (rejection) -&gt;
      q.reject(rejection) # Return the promise rejection
  ...
  </code></pre>