title: Jasmine spyOn scope function breaks test
body: <h1>Case</h1>
  
  <p>When I create a spy on <code>rootScope</code>, the expectation fails for some reason. Check out the plunkr and try just commenting it out and reversing to see.</p>
  
  <h1>Code</h1>
  
  <p><a href="http://plnkr.co/edit/ex8GZIA9PBpbIhlZgqCF?p=preview" rel="nofollow">Plunker Example</a></p>
  
  <pre><code>describe('Testing', function() {
    var rootScope = null
  
    //you need to indicate your module in a test
    // beforeEach(module('plunker'));
  
    beforeEach(inject(function($rootScope, $controller) {
      rootScope = $rootScope;
  
      rootScope.value = false;
  
      rootScope.testFn = function() {
        rootScope.value = true;
      }
    }));
  
    it('should modify root scope', function() {
      // Creating this spy makes test fail
      // Comment it outto make it pass
      spyOn(rootScope, 'testFn');
      expect(rootScope.value).toEqual(false);
      rootScope.testFn();
      expect(rootScope.value).toEqual(true);
    });
  });
  </code></pre>