title: Unit test with spy is failing. Says spy was never called
body: <p>This is the code I'm testing</p>
  
  <pre><code>eventsApp.factory('userData', ['userResource', function(userResource){
      return{
      getUser: function(userName, callback){
          return userResource.get({userName:userName}, function(user){
          if(callback)
          callback(user);
          });
  
      };
  }]);
  </code></pre>
  
  <p>And this is the Jasmine test for it</p>
  
  <pre><code>describe('userData', function(){
      var mockUserResource;
  
      beforeEach(module('eventsApp'));
  
      beforeEach(function(){
          mockUserResource = {get: function(){} };
  
          module(function($provide){
              $provide.value('userResource', mockUserResource);
          });
      });
  
      it('should make a call to userResource.get with provided userName', inject(function(userData){
  
          userData.getUser('Bob');
          spyOn(mockUserResource, 'get');
          expect(mockUserResource.get).toHaveBeenCalledWith({userName:'Bob'});
      }));
  });
  </code></pre>
  
  <p>Why is this failing?  It says </p>
  
  <blockquote>
    <p>"Expected spy get to have been called with [ { userName : 'Bob' } ]
    but it was never called".</p>
  </blockquote>
  
  <p><code>.toHaveBeenCalled()</code> also fails.</p>