title: TypeError: 'undefined' is not an object (evaluating 'currentSpec.queue.running')
body: <p>I am using karma + jasmine.</p>
  
  <p>Now thatI have tried one way of mocking a dependent factory I get this error:</p>
  
  <pre><code>TypeError: 'undefined' is not an object (evaluating 'currentSpec.queue.running')
  at C:/test/test/client/app/bower_components/angular-mocks/angular-mocks.js:1924
  at C:/test/test/client/app/bower_components/angular-mocks/angular-mocks.js:1979
  at C:/test/test/client/test/spec/services/lessonplannerfactory.js:31
  at C:/test/test/client/node_modules/karma-jasmine/lib/boot.js:117
  at C:/test/test/client/node_modules/karma-jasmine/lib/adapter.js:171
  at http://localhost:3000/karma.js:189
  at http://localhost:3000/context.html:85
  
  
  // load the service's module
  beforeEach(module('clientApp'));
  
  var lessonPlannerFactory;
  var data;
  
  beforeEach(inject(function (_lessonPlannerFactory_, _dailyPeriodsTestDataFactory_) {  // The underscores before/after the factory are removed by the $injector
      lessonPlannerFactory = _lessonPlannerFactory_;
      data = _dailyPeriodsTestDataFactory_;
  
  }));
  
  beforeEach(function(){
      // Arrange
      var dateFactory = {
          getVisibleDateRange: function (startDate, endDate, visibleWeekDays) {
              // I do not care about the parameters, I just want to stub out the visible days with 2 stubs
              return [
                  moment(new Date(2014,0,1)),
                  moment(new Date(2014,0,2))
              ];
          }
      };
  
      module(function ($provide) {
          $provide.value('dateFactory', dateFactory);
      });
  });
  
  it('creates periods by daily rotation and a given timetable', function() {
  
      // Act
      var periods = lessonPlannerFactory.createPeriodsDaily(data.startDate, data.endDate, data.visibleDays, data.rotation, data.timetableEntries);
  
      // Assert
  
  });
  </code></pre>
  
  <p>// LessonplannerFactory</p>
  
  <pre><code>angular.module('clientApp').factory('lessonPlannerFactory',['dateFactory', function (dateFactory) { // inject the dateFactory into this factory
  
      function createPeriodsDaily(startDate, endDate, visibleDays, weeklyRotation, timeTableEntries) {
  
          var visibleDateRange = dateFactory.getVisibleDateRange(startDate,endDate, visibleDays);
  
          // todo: Implement the whole algorythm
          var query = visibleDateRange;
          return query;
      }
  
      return {
          createPeriodsDaily: createPeriodsDaily
  
      };
  }]);
  </code></pre>
  
  <p>// DateFactory</p>
  
  <pre><code>angular.module('clientApp').factory('dateFactory', function () {
  
      /// Computes all visible days with a given start date and end date (timespan)
      // startDate: momentJS object
      // endDate: momentJS object
      // visibleWeekDays: integer array of day index of a week
      function getVisibleDateRange(startDate, endDate, visibleWeekDays) {
          var visibleDateRange = [];
  
          // todo: Implement the algorythm
  
          return visibleDateRange;
      }
  
      return {
          getVisibleDateRange: getVisibleDateRange
      };
  });
  </code></pre>
  
  <p>The lessonplannerFactory uses the dateFactory so I have to mock it for a real unit test.</p>
  
  <p>When this code is run in debugging:</p>
  
  <pre><code>module(function ($provide) {
              $provide.value('dateFactory', dateFactory);
          });
  </code></pre>
  
  <p>Then the debugging stops because somewhere in the code happens the error posted at the top.</p>
  
  <p>I know this link: <a href="https://stackoverflow.com/questions/22410823/issue-with-jasmine-testing-on-angularjs-module-not-found">Module not found error in AngularJS unit test</a></p>
  
  <p>It has my error message, but I do not understand the solution to adapt it to my scenario.</p>
  
  <p>Anyone can help please?</p>