title: How to change return value of jasmine spy?
body: <p>I'm using Jasmine to create a spy like so:</p>
  
  <pre><code>beforeEach(inject(function ($injector) {
      $rootScope = $injector.get('$rootScope');
      $state = $injector.get('$state');
      $controller = $injector.get('$controller');
  
      socket = new sockMock($rootScope);
  
      //this is the line of interest
      authService = jasmine.createSpyObj('authService', ['login', 'logout', 'currentUser']);
  }));
  </code></pre>
  
  <p>I'd like to be able to change what's returned by the various methods of <code>authService</code>.</p>
  
  <p>Here are how the actual tests are set up:</p>
  
  <pre><code>function createController() {
      return $controller('UserMatchingController', {'$scope': $rootScope, 'socket':socket, 'authService': authService });
  }
  
  describe('on initialization', function(){
      it('socket should emit a match', function() {
          createController();
  
          expect(socket.emits['match'].length).toBe(1);
      });
  
      it('should transition to users.matched upon receiving matched', function(){
  
          //this line fails with "TypeError: undefined is not a function"
          authService.currentUser.andReturn('bob');
  
          createController();
  
          $state.expectTransitionTo('users.matched');
          socket.receive('matchedblah', {name: 'name'});
  
          expect(authService.currentUser).toHaveBeenCalled()
      })
  })
  </code></pre>
  
  <p>Here's how the controller is set up:</p>
  
  <pre><code>lunchrControllers.controller('UserMatchingController', ['$state', 'socket', 'authService',
      function ($state, socket, authService) {
          socket.emit('match', {user: authService.currentUser()});
  
          socket.on('matched' + authService.currentUser(), function (data) {
              $state.go('users.matched', {name: data.name})
          });
      }]);
  </code></pre>
  
  <p>Essentially, I'd like to be able to change the return value of spied methods. However, I'm not sure if I'm correctly approaching the problem by using <code>jasmine.createSpyObj</code>.</p>