title: Jasmine Test- Need to manually set values to be expected
body: <p>For testing with Angular.js, Mocha, and Jasmine I have this test for <code>DeviceVal</code> value file: </p>
  
  <pre><code>describe("load balancer device: value", function() {
    var DeviceVal;
    DeviceVal = null;
    beforeEach(function() {
      return module("main.loadbalancer");
    });
    beforeEach(inject(function(_DeviceVal_) {
      return DeviceVal = _DeviceVal_;
    }));
    return it("should default the id to 'device not loaded'", function() {
      return expect(DeviceVal).toEqual({
        readonly: false,
        lb: "device not loaded"
      });
    });
  });
  </code></pre>
  
  <p>For one of my other tests, I have this which uses the <code>DeviceVal</code> value file:</p>
  
  <pre><code>describe("load balancer controller: readonly", function() {
    $scope = DeviceVal = LoadBalancerSvc = SearchSvc = $state = $sce = null;
  
    beforeEach(function() {
      module('main');
    });
  
    beforeEach(inject(function($controller, $rootScope, _$state_, _LoadBalancerSvc_, _DeviceVal_) {
      $scope = $rootScope.$new();
      $state = _$state_;
      LoadBalancerSvc = _LoadBalancerSvc_;
      DeviceVal = _DeviceVal_;
  
      $controller('HeaderCtrl', {$scope: $scope});
      //to resolve all the promises we have on the mocked service
      $scope.$digest();
      lb = { ha_status: "secondary", id: "34584"};
      this.lb = lb;
      spyOn(LoadBalancerSvc, "searchDevice").and.returnValue(
        {get: function() {
            return { then: function(fn) { fn(lb)} }}});
      spyOn($state, "go");
    }));
  
    it('scope data memembers to have their stuff', function() {
      $scope.searchButton.submit();
      expect(lb).toEqual(this.lb);
      expect(lb['ha_status']).toEqual("secondary");
      expect(DeviceVal.readonly).toBe(true);
      expect($state.go).toHaveBeenCalledWith("main.loadbalancer.vips", {id: this.lb.id});
      });
  });
  </code></pre>
  
  <p>The issue I am having is I want to manually set the values in the second test of <code>DeviceVal</code> to custom values. But instead, the test expects the values to be the values in the first <code>DeviceVal</code> test file. It complains of:</p>
  
  <pre><code>Expected { readonly : true, lb : { ha_status : 'secondary', id : '34584' } } to equal { readonly : false, lb : 'device not loaded' }.
  </code></pre>
  
  <p>How can I make the second test where I can manually set the values <code>DeviceVal.lb = { ha_status: "secondary", id: "34584"};</code> and have <code>expect(lb['ha_status']).toEqual("secondary");</code> and <code>expect(DeviceVal.readonly).toBe(true);</code>?</p>
  
  <hr>
  
  <p><strong>UPDATE</strong>:</p>
  
  <p>Here it is with mock DeviceVal, but I still get <code>Error: Expected { readonly : true, lb : { ha_status : 'secondary', id : '34584' } } to equal { readonly : fals
  e, lb : 'device not loaded' }.</code>:</p>
  
  <pre><code>describe("load balancer controller: readonly", function() {
    $scope = DeviceVal = LoadBalancerSvc = SearchSvc = $state = $sce = null;
  
    beforeEach(function() {
      module('main');
    });
  
    beforeEach(inject(function($controller, $rootScope, _$state_, _LoadBalancerSvc_, _DeviceVal_) {
      $scope = $rootScope.$new();
      $state = _$state_;
      LoadBalancerSvc = _LoadBalancerSvc_;
      DeviceVal = _DeviceVal_;
  
      $controller('HeaderCtrl', {$scope: $scope});
      //to resolve all the promises we have on the mocked service
      $scope.$digest();
  
      //MY ATTEMPT AT MOCKING THIS DATA
      DeviceVal.lb = { ha_status: "secondary", id: "34584"};
      DeviceVal.readonly = true;
  
      spyOn(LoadBalancerSvc, "searchDevice").and.returnValue(
        {get: function() {
            return { then: function(fn) { fn(DeviceVal.lb)} }}});
      spyOn($state, "go");
    }));
  
    it('scope data memembers to have their stuff', function() {
      $scope.searchButton.submit();
      expect(DeviceVal.lb).toEqual({ha_status: "secondary", id: "34584"});
      expect(DeviceVal.lb['ha_status']).toEqual("secondary");
      expect(DeviceVal.readonly).toBe(true);
      expect($state.go).toHaveBeenCalledWith("main.loadbalancer.vips", {id: DeviceVal.lb.id});
      });
  });
  </code></pre>