title: jasmine: scope of this
body: <p>From the jasmine documentation (<a href="http://jasmine.github.io/2.0/introduction.html" rel="noreferrer">http://jasmine.github.io/2.0/introduction.html</a>):</p>
  
  <blockquote>
    <p>The this keyword</p>
    
    <p>Another way to share variables between a beforeEach, it, and afterEach is through the this keyword. Each spec’s beforeEach/it/afterEach has the this as the > same empty object that is set back to empty for the next spec’s beforeEach/it/afterEach.</p>
  </blockquote>
  
  <p>My understanding of this in Javascript is, that this is bounded to the scope of the actual function. So I would expect that it would be bound to the context different contexts (the ones depending on the function) inside beforeEach/it/afterEach.</p>
  
  <p>e.g.</p>
  
  <pre><code>describe('Spec', function (){
    var eachThis = null;
    beforeEach(function(){
      eachThis = this;
    });
    it('check this', function(){
      except(this).toEqual(eachThis);
    }
  };
  </code></pre>
  
  <p>So this test should pass.</p>
  
  <p>Did jasmine change the behavior of this or did i get something wrong?</p>