title: Using Jasmine to test object initialization within Angular controller
body: <p>I have a controller that initializes an object upon initialization of the controller, and would like to test that it was called with the specific params that it is actually called with. </p>
  
  <p>I know that I can test that $scope.autoSaveObj has certain properties that would tell me that it in fact initialized, but how would I spy on the initialization event itself?</p>
  
  <p>Essentially, I want to spy on new autoSaveObj just like I would a method. </p>
  
  <p>The main reason I want to test and spy on the object contructor is so that my karma-coverage plugin will show those lines as covered. It won't show the lines as covered if I just test the state of $scope.autoSaveObject after the initialization. </p>
  
  <pre><code>App.controller('ItemCtrl',[ '$scope', function($scope){
    $scope.autoSaveObject = new autoSaveObj({
      obj: $scope.item,
      saveCallback: function() {
                    return $scope.saveItem();
                  },
      errorCallback: null,
      saveValidation: $scope.validItem,
      delay: 2000
    });
  }]);
  </code></pre>