Sha256: e8377ce95fc644377ee69c443771d4ff18f06158439ea36a0ec6803a3810e157
Contents?: true
Size: 760 Bytes
Versions: 12
Compression:
Stored size: 760 Bytes
Contents
RealFile = File RealFileUtils = FileUtils RealDir = Dir RealFileUtils::Dir = RealDir RealFileUtils::File = RealFile module FakeFS def self.activate! Object.class_eval do remove_const(:Dir) remove_const(:File) remove_const(:FileUtils) const_set(:Dir, FakeFS::Dir) const_set(:File, FakeFS::File) const_set(:FileUtils, FakeFS::FileUtils) end end def self.deactivate! Object.class_eval do remove_const(:Dir) remove_const(:File) remove_const(:FileUtils) const_set(:Dir, RealDir) const_set(:File, RealFile) const_set(:FileUtils, RealFileUtils) end end end def FakeFS return ::FakeFS unless block_given? ::FakeFS.activate! yield ensure ::FakeFS.deactivate! end
Version data entries
12 entries across 12 versions & 3 rubygems