title: Unit test AngularJs $resource query with params
body: <p>I would like to know how to unit test AngularJs $resource query with params.</p>
  
  <p>I have this:</p>
  
  <p><strong>services.js</strong></p>
  
  <pre><code>angular.module('conciergeApp.services', ['ngResource'])
      .factory('Reply', function($resource) {
          return $resource('/api/reply/:id/');
      });
  </code></pre>
  
  <p><strong>controllers.js</strong></p>
  
  <pre><code>conciergeControllers.controller('ReplyCtrl', ['$scope', 'Reply',
      function($scope, Reply) {
  
          $scope.hotel_replies = Reply.query({
              hotel: $scope.hotel_id
          });
      }
  ]);
  </code></pre>
  
  <p>So, the API Endpoint that gets queried here is:</p>
  
  <pre><code>'/api/reply/?hotel=&lt;hotel_id&gt;'
  
  // aka
  
  '/api/reply/?hotel=1'
  </code></pre>
  
  <p>This works when manually tested, but how do you unit test this? </p>
  
  <p>With <code>Jasmine spyOn</code>, or <code>$httpBackend</code>.  Whichever would be fine?</p>
  
  <p>Can this be used?  I tried this pattern, but couldn't do it successfully:</p>
  
  <pre><code>spyOn(object, 'method').andCallFake(function({foo:bar}) {
    return myMockObject
  });
  </code></pre>