// File: chapter7/notesApp1SpecWithSpyReturn.js

describe('ItemCtrl with SpyReturn', function() {
  beforeEach(module('notesApp1'));

  var ctrl, itemService;

  beforeEach(inject(function($controller, ItemService) {

    spyOn(ItemService, 'list')
        .andReturn([{id: 1, label: 'Mock'}]);
    itemService = ItemService;
    ctrl = $controller('ItemCtrl');
  }));

  it('should load mocked out items', function() {
    expect(itemService.list).toHaveBeenCalled();
    expect(itemService.list.callCount).toEqual(1);
    expect(ctrl.items).toEqual([{id: 1, label: 'Mock'}]);
  });
});

@@ -254,217 +254,718 @@
     
-.andReturn(%5B%7Bid: 1, label: 'Mock'%7D%5D);%0A    itemService = ItemService;%0A    ctrl = $controller('ItemCtrl');%0A  %7D));%0A%0A  it('should load mocked out items', function() %7B%0A    expect(itemService.list).toHaveBeenCalled(
+// According to latest version of jasmine docs, andReturn() method has updated to and.returnValue() method%0A        // http://jasmine.github.io/2.0/introduction.html#section-Spies:_%3Ccode%3Eand.returnValue%3C/code%3E%0A        //.and.returnValue(%5B%7Bid: 1, label: 'Mock'%7D%5D);%0A        .andReturn(%5B%7Bid: 1, label: 'Mock'%7D%5D);%0A    itemService = ItemService;%0A    ctrl = $controller('ItemCtrl');%0A  %7D));%0A%0A  it('should load mocked out items', function() %7B%0A    expect(itemService.list).toHaveBeenCalled();%0A    // According to latest version of jasmine docs, callCount property has updated to calls.count() method%0A    // http://jasmine.github.io/2.0/introduction.html#section-24%0A    // expect(itemService.list.calls.count()).toEqual(1
 );%0A 

Update notesApp1SpecWithSpyReturn.js