Angular Karma Jasmine forEach@ Error
<p>I'm trying to test an interceptor with Karma and Jasmine, but having unexpected errors. I was following this code: <a href="http://jbavari.github.io/blog/2014/06/20/testing-interceptor-headers-in-angularjs/" rel="nofollow">http://jbavari.github.io/blog/2014/06/20/testing-interceptor-headers-in-angularjs/</a></p>

<p>Code:</p>

<pre><code>angular
    .module('xos.helpers',[
      'ngCookies',
      'xos.xos',
      'xos.hpcapi',
      'xos.xoslib',
      'bugSnag'
    ])
    .config(config);

function config($httpProvider, $resourceProvider) {
  console.log('xos.helpers config')
  $httpProvider.interceptors.push('SetCSRFToken');

  $interpolateProvider.startSymbol('{$');
  $interpolateProvider.endSymbol('$}');

  // NOTE http://www.masnun.com/2013/09/18/django-rest-framework-angularjs-resource-trailing-slash-problem.html
  $resourceProvider.defaults.stripTrailingSlashes = false;
}
</code></pre>

<p>Test:</p>

<pre><code>  'use strict';
    describe('The xos.helper module', function(){
      var SetCSRFToken, httpProviderObj;

      beforeEach(module('xos.helpers'));

      beforeEach(module(function(_$httpProvider_){
        httpProviderObj = _$httpProvider_;
      }));

      beforeEach(inject(function(_SetCSRFToken_){
        SetCSRFToken = _SetCSRFToken_;
      }));

      it('should exist', () =&gt; {
        expect(SetCSRFToken).toBeDefined();
      });

      it('should set SetCSRFToken interceptor', () =&gt; {
        expect(httpProviderObj).toBeDefined();
        expect(httpProviderObj.interceptors).toContain('SetCSRFToken');
      });
});
</code></pre>

<p>In karma conf all needed files are loaded but I'm getting this unknown error:</p>

<pre><code>/Users/teone/Sites/xos/views/ngXosLib/bower_components/angular/angular.js:4414:53
forEach@/Users/teone/Sites/xos/views/ngXosLib/bower_components/angular/angular.js:336:24
loadModules@/Users/teone/Sites/xos/views/ngXosLib/bower_components/angular/angular.js:4374:12
createInjector@/Users/teone/Sites/xos/views/ngXosLib/bower_components/angular/angular.js:4299:22
workFn@/Users/teone/Sites/xos/views/ngXosLib/bower_components/angular-mocks/angular-mocks.js:2427:60
Expected undefined to be defined.
/Users/teone/Sites/xos/views/ngXosLib/xosHelpers/spec/csrftoken.test.js:17:37
</code></pre>

<p>Any idea?</p>