Created
          July 21, 2014 19:10 
        
      - 
      
- 
        Save ahmednuaman/844922f2f27d61d3a235 to your computer and use it in GitHub Desktop. 
    That's a naughty JS dev
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | describe('scoping', function () { | |
| it('should correctly deal with scoping `this` back to the callee', function () { | |
| var mod = new Module(), | |
| request; | |
| request = function (callback) { | |
| return callback(); | |
| }; | |
| function Module () { | |
| this.foo = 'bar'; | |
| } | |
| Module.prototype.method = function() { | |
| // return this.foo; | |
| return 'bar'; | |
| }; | |
| Module.prototype.req = function() { | |
| return request(this.method); | |
| }; | |
| expect(mod.req()).toBe('bar'); | |
| }); | |
| }); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment