title: Jasmine mock window.location.reload(true);
body: <p>I have a constructor of a js object that looks like this:</p>
  
  <pre><code>function SomeThing(window, document) {
     var self = this;
     self.window = window;
     self.document = document;
  
     if (!self.window.sessionStorage.getItem('page-reloaded')) {
        self.window.sessionStorage.setItem('page-reloaded', true);
        self.window.location.reload(true); // PROBLEM ON THIS LINE
        return;
     }
  }
  </code></pre>
  
  <p>my mock test looks like this:</p>
  
  <pre><code>beforeEach(function() {
    mockWindowObj = {
      'location': {
          'href': '',
          'search': '?hello=world',
          'pathname': '/some/path',
          'replace': function () {},
          'reload': jasmine.createSpy()
        }
     };
  
    spyOn(mockWindowObj.location, 'reload').and.callFake(function(){}); ;
  
    some = new SomeThing(mockWindowObj, mockDocumentObj);
  });
  </code></pre>
  
  <p>When I run a test I get this error: </p>
  
  <pre><code>PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR
   {
     "message": "Some of your tests did a full page reload!",
     "str": "Some of your tests did a full page reload!"
   }
  </code></pre>
  
  <p>If I comment out the line <code>window.location.reload(true)</code> all of my test run fine and pass.  I'm sort of new to unit tests and I'm not sure how to get around this. Any help would be very much appreciated. Thanks in advance.</p>