Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 4864

Show
Ignore:
Timestamp:
08/30/06 04:02:15 (2 years ago)
Author:
madrobby
Message:

a bit more agile this way

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • spinoffs/scriptaculous/src/unittest.js

    r4863 r4864  
    387387    this.name           = name; 
    388388     
    389     if(test instanceof Array) { 
     389    if(typeof test == 'string') { 
    390390      this.test = function() { 
    391         var preppedTest = test.join('\n'); 
    392         ['assert','wait','benchmark','info'].each(function(i){ 
    393           preppedTest = preppedTest.gsub(i,'this.'+i); 
    394         }); 
    395         eval(preppedTest); 
     391        eval('with(this){'+test+'}'); 
    396392      } 
    397393    } else { 
     
    441437          return statement.strip() 
    442438        }); 
    443         compiledSpec[testName] = body
     439        compiledSpec[testName] = body.join('\n')
    444440    } 
    445441  }