title: testing angular services with mocha
body: <p>I've been trying to unit test some angular js services <strong>using Mocha</strong> by injecting mock dependencies. I've read a lot about this and there is some suggestion that using the master branch of <a href="https://github.com/angular/angular.js/blob/639786083151ff93d70d31332bad143483140de0/src/ngMock/angular-mocks.js" rel="nofollow">angular-mocks</a> should work fine with mocha. However, when I try this, I get the follwing javascript error and the 'inject' and 'module' functions are undefined:</p>
  
  <p><code>ReferenceError: beforeEach is not defined</code></p>
  
  <p>I've also tried using angular.injector, which has led me to some success, however, I am unable to mock the services which my service depend on (in this case $http). My service:</p>
  
  <pre><code>var app = angular.module('app', ['ui.bootstrap'], function($provide){
      $provide.factory('myService', ['$http', function($http){
          return { 
              doSomething: function(batch){
                  ...
              }
          };
      }]);
  });
  </code></pre>
  
  <p>Resolving:</p>
  
  <pre><code>$injector = angular.injector(['ng', 'app']);
  var subject = $injector.get('myService');
  </code></pre>
  
  <p>Is this possible without using jasmine?</p>