title: Why do I receive error ... unexpected request: GET /internalapi/quotes
body: <p>I've defined the following service in my angular app :</p>
  
  <pre><code>services.factory('MyService', ['Restangular', function (Restangular) {
         return {
             events : { loading : true },
  
             retrieveQuotes : function() {
                 return Restangular.all('quotes').getList().then(function() {
                     return { hello: 'World' };
                 });
             }
      };
  }]);
  </code></pre>
  
  <p>and I'm writing the following spec to test it :</p>
  
  <pre><code>describe("MyService", function () {
  
      beforeEach(module('MyApp'));
      beforeEach(module("restangular"));
  
      var $httpBackend, Restangular, ms;
  
      beforeEach(inject(function (_$httpBackend_, _Restangular_, MyService) {
          ms = MyService;
          $httpBackend = _$httpBackend_;
          Restangular = _Restangular_;
      }));
  
  
      it("retrieveQuotes should be defined", function () {
          expect(ms.retrieveQuotes).toBeDefined();
      });
  
      it("retrieveQuotes should return array of quotes", function () {
  
          $httpBackend.whenGET("internalapi/quotes").respond({ hello: 'World' });
          ms.retrieveQuotes();
          $httpBackend.flush();
      });
  
  });
  </code></pre>
  
  <p>Whenever I run the tests, the first test passes but the second test produces the error :</p>
  
  <p><code>Error: Unexpected request: GET /internalapi/quotes</code></p>
  
  <p>What am I doing wrong?</p>
  
  <p>EDIT:</p>
  
  <p>It turned out I'd configured <code>Restangular</code> like so ... <code>RestangularProvider.setBaseUrl("/internalapi");</code>. But I was faking calls to <code>internalapi/quotes</code>. Notice the lack of the "/". Once I added the slash <code>/internalapi/quotes</code> all was good :)</p>