jasmine mocking angular $http - Error: describe does not expect a done parameter
<p>I have an angular factory like this:</p>

<pre><code>.factory('widgetFactory', ['$http', function($http){
  function getWidgets(){
    return $http.get('http://example.com/api/widgets/')
     .then(function(response){
        return response;
     });
  }
  return {
    getWidgets:getWidgets
  };
}])
</code></pre>

<p>And I have the following jasmine test:</p>

<pre><code>describe('widgetFactory', function ($q) {
  var mockHttp,
  fakeResponse = 'response'
  beforeEach(function() {

    mockHttp = {
      get: jasmine.createSpy('get spy').and.callFake(function () {
        var deferred = $q.defer();
        deferred.resolve(fakeResponse);
        return deferred.promise;
      })
    };

    module(function ($provide) {
      $provide.value('$http', mockHttp);
    });

  });

  it('should call api when getWidgets is called', inject(function (widgetFactory) {
    var result;
    widgetFactory.getWidgets().then(function(response){
      result = response;
    });
    expect(mockHttp.post).toHaveBeenCalledWith('http://example.com/api/widgets/');
    expect(result).toBe(fakeResponse);
  }));
});
</code></pre>

<p>But I get the following error: <strong>describe does not expect a done parameter</strong></p>

<p>I think it may be to do with how I'm using $q in my test (other examples I've seen have <code>inject(function($q){ ...</code> inside the <code>beforeEach</code>, but I can't due to my use of <code>module</code> inside <code>beforeEach</code> as this then gives me the following error: Injector already created, can not register a module!)</p>

<p>Any ideas?</p>