Permalink
Browse files

Rename .fake() to .patch()

  • Loading branch information...
eldargab committed Sep 13, 2012
1 parent 6199826 commit ed54665dafbd81563fc21f06ade264f776b50a0f
Showing with 8 additions and 8 deletions.
  1. +2 −2 lib/fake-fs.js
  2. +6 −6 test/fake-fs.js
View
@@ -155,7 +155,7 @@ Fs.prototype.mkdir = function (dir, mode, cb) {
cb && cb(err, res)
}
-Fs.prototype.fake = function () {
+Fs.prototype.patch = function () {
this._orig = {}
var fs = require('fs')
methods.forEach(function (meth) {
@@ -164,7 +164,7 @@ Fs.prototype.fake = function () {
}, this)
}
-Fs.prototype.unfake = function () {
+Fs.prototype.unpatch = function () {
var fs = require('fs')
for (var key in this._orig) {
fs[key] = this._orig[key]
View
@@ -288,28 +288,28 @@ describe('Fake FS', function () {
})
})
- describe('.fake()', function () {
+ describe('.patch()', function () {
afterEach(function () {
- fs.unfake()
+ fs.unpatch()
})
it('Should patch global fs with self methods', function () {
var global = require('fs')
var origStat = global.stat
- fs.fake()
+ fs.patch()
global.statSync.should.not.equal(origStat)
global.existsSync('abrakadabra').should.be.false
fs.dir('abrakadabra')
global.existsSync('abrakadabra').should.be.true
})
})
- describe('.unfake()', function () {
+ describe('.unpatch()', function () {
it('Should restore original fs methods', function () {
var global = require('fs')
var origStat = global.stat
- fs.fake()
+ fs.patch()
origStat.should.not.equal(global.stat)
- fs.unfake()
+ fs.unpatch()
origStat.should.equal(global.stat)
})
})

0 comments on commit ed54665

Please sign in to comment.