title: Angularjs unit testing and httpbackend timeout
body: <p>I m not new in test world as I worked for many times in TDD using mocha sinon chai and nodejs.</p>
  
  <p>I m actually a bit disturbed with Angularjs testing and the way it works.</p>
  
  <p>Actually, I need to test the simplest method I can do with this :</p>
  
  <pre><code>/** @test {HateoasService#loadRessource}*/
  describe('HateoasService', function() {
  
    let service = null;
    let remoteBackend = null;
    beforeEach(angular.mock.module('app'));
  
    beforeEach(inject((HateoasService, $httpBackend) =&gt; {
      remoteBackend = $httpBackend;
      service = HateoasService;
    }));
  
    afterEach(function() {
      remoteBackend.verifyNoOutstandingExpectation();
      remoteBackend.verifyNoOutstandingRequest();
    });
  
    it('should be resolved a promise with status 200', () =&gt; {
  
      remoteBackend.when('GET', 'http://google.fr')
        .respond(200, {});
  
      service.loadRessource('http://google.fr').then((res) =&gt; {
        expect(res.status).toEqual(200);
        remoteBackend.flush();
      });
    });
  
  });
  </code></pre>
  
  <p>That should cover this code :</p>
  
  <pre><code>loadRessource(ressource) {
      return this.http.get(ressource);
    }
  </code></pre>
  
  <p>However, it seems that I m missing something since I m having a trouble with httBackend flushing :  Error: Unflushed requests: 1.</p>
  
  <p>Can you help me make this test working ?</p>