title: "$httpBackend.when is not a function" error when mocking AngularJS $httpBackend in Jasmine tests and using a decorator
body: <p>I'm using a decorator for Angular service $httpBackend to change the urls of all http calls:</p>
  
  <pre><code>app.config(function($provide) {
     $provide.decorator('$httpBackend', function($delegate) {
        return function(method, url, post, callback, headers, timeout, withCredentials, responseType) {
            url = changeUrl(url);
            $delegate(method, url, post, callback, headers, timeout, withCredentials, responseType);
        };
     })
  });
  </code></pre>
  
  <p>In some Jasmine tests I need to mock the $httpBackend service: </p>
  
  <pre><code>describe('...', function() {
      beforeEach(module('...'));
      beforeEach(inject(function($injector) {
          $httpBackend = $injector.get('$httpBackend');
          $httpBackend.when('GET', '...').respond(function(method, url) {
              return ...
          });
      }));
  }
  </code></pre>
  
  <p>Now I'm getting error "$httpBackend.when is not a function" when executing these tests.</p>
  
  <p>Any idea how to fix this? I'd prefer a solution without having test specific code in my app config.  </p>