title: Karma - Expected undefined to equal
body: <p>I've got my mock window object and method: </p>
  
  <pre><code>var window = {
      open: function (url, target, specs) {
          var spec, specKey;
          this.href = url;
          this.target = target;
          // Parse through the spec string to grab the parameters you passed through
          var specArray = specs.split(',');
          for (specKey in specArray) {
              spec = specArray[specKey].split('=');
              this[String.trim(spec[0])] = String.trim(spec[1]);
          }
      }
  };
  </code></pre>
  
  <p>and my test case:</p>
  
  <pre><code>describe('$scope.popup1', function () {
  
      it('should open a popup window when ISIN hyperlink is clicked within grid, passing ISIN object s values to shareDataService', inject(function ($window) {
          spyOn($window, 'open').and.callFake(function () {
              return true;
          });
          scope.popup1()
          expect(window.open).toHaveBeenCalled();
          expect(window.open.href).toEqual("views/Box_Ladder.html");
      })
     )
  })
  </code></pre>
  
  <p>But I get <code>Expected undefined to equal 'views/Box_Ladder.html'</code>.  I'm not sure how window.open.href is undefined seeing as I declared it above?</p>
  
  <p>EDIT - updated code, still same error:</p>
  
  <pre><code>describe('mainCtrl', function () {
  
  beforeEach(module('app'));
  var controller, scope;
  var window = {
      open: function (url, target, specs) {
  console.log("function being called")
          var spec, specKey;
          this.href = url;
          this.target = target;
          // Parse through the spec string to grab the parameters you passed through
          var specArray = specs.split(',');
          for (specKey in specArray) {
              spec = specArray[specKey].split('=');
              this[String.trim(spec[0])] = String.trim(spec[1]);
          }
      }
  };
  
  beforeEach(inject(function ($controller, $window, $rootScope) {
      scope = $rootScope.$new();
      controller = $controller('mainCtrl', {$scope: scope});
      window = $window;
  }));
  
  describe('$scope.popup1', function () {
  
      it('should open a popup window when ISIN hyperlink is clicked within grid, passing ISIN object s values to shareDataService', inject(function ($window) {
          spyOn($window, 'open').and.callThrough()
          scope.popup1()
          expect(window.open).toHaveBeenCalled();
          expect(window.href).toEqual("views/Box_Ladder.html");
          //expect(window.location.target).toEqual("_blank");
          //expect(window.location.height).toEqual(400);
          //expect(window.width).toEqual(700);
      })
     )
  })
  });
  </code></pre>
  
  <p>And popup1() function:</p>
  
  <pre><code>$scope.popup1 = function (isinData) {
      var popup1 = window.open("views/Box_Ladder.html", "_blank",
                          "height = 400, width = 700");
      shareDataService.setIsinClickValue(isinData);
  }
  </code></pre>