Skip to content

Instantly share code, notes, and snippets.

@phishy

phishy/model.js Secret

Created February 16, 2015 02:43
Show Gist options
  • Save phishy/cb06c276a332b01ec149 to your computer and use it in GitHub Desktop.
Save phishy/cb06c276a332b01ec149 to your computer and use it in GitHub Desktop.
module.exports = {
find: function() {
return undefinedVar;
}
};
var rewire = require('rewire');
var model = rewire('./model');
var expect = require('chai').expect;
describe('rewire', function(){
before(function(){
model.__set__({
undefinedVar: 'hello'
});
});
it('should be able to set an undefined variable', function(){
var out = model.find();
expect(out).to.eql('hello');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment