title: Jasmine spyOn not working
body: <p>I am fairly new to Jasmine, and I have to test a few function calls:</p>
  
  <p><strong>JS CODE</strong></p>
  
  <pre class="lang-js prettyprint-override"><code> object1 = {
  
      function1: function() {
         // object1.function2 is a callback
         object2.someFunction("called", object1.function2)
      },
  
      function2:  function() {
         // code to do stuff
      }
  
   }
  </code></pre>
  
  <p><strong>TEST CODE</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>describe("test suite", function(){ 
       it("test1", function(){ 
            spyOn(object1, "function2");
            object1.function1();
            expect(object1.function2).toHaveBeenCalled();
       });
  });
  </code></pre>
  
  <p>I've tried the above but it fails, and says "Expected spy function2 to have been called". Can somebody help me out with this ? Thanks</p>