title: Jasmine test : Showing variables of angularjs controllers as undefined in test
body: <p>I am not able to get variable in test case it is showing undefined in test case.
  Controller:</p>
  
  <pre><code>   $scope.sample = function(){
        var id="151201";
        });
  </code></pre>
  
  <p>Test:</p>
  
  <pre><code>var ctrl, scope, ;
  
    beforeEach(inject(
      function($controller, $rootScope){
   scope = $rootScope.$new();
        scope.$digest();
    ctrl = $controller('controller', {
          $scope:scope
        });
    describe('scope functions', function() {
      it('sample', function() {
          expect(id).toBe('151201')
      });
  });
  </code></pre>
  
  <p>Getting an error :<strong>Expecting undefined to be 151201</strong></p>