Module: FakeFS

Defined in:
lib/fakefs/dir.rb,
lib/fakefs/base.rb,
lib/fakefs/file.rb,
lib/fakefs/version.rb,
lib/fakefs/fake/dir.rb,
lib/fakefs/fake/file.rb,
lib/fakefs/file_test.rb,
lib/fakefs/fileutils.rb,
lib/fakefs/file_system.rb,
lib/fakefs/fake/symlink.rb,
lib/fakefs/spec_helpers.rb

Defined Under Namespace

Modules: FileSystem, FileUtils, SpecHelpers, Version Classes: Dir, FakeDir, FakeFile, FakeSymlink, File, FileTest

Class Method Summary collapse

Class Method Details

.activate!Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/fakefs/base.rb', line 7

def self.activate!
  Object.class_eval do
    remove_const(:Dir)
    remove_const(:File)
    remove_const(:FileTest)
    remove_const(:FileUtils)

    const_set(:Dir,       FakeFS::Dir)
    const_set(:File,      FakeFS::File)
    const_set(:FileUtils, FakeFS::FileUtils)
    const_set(:FileTest,  FakeFS::FileTest)
  end
  true
end

.deactivate!Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/fakefs/base.rb', line 22

def self.deactivate!
  Object.class_eval do
    remove_const(:Dir)
    remove_const(:File)
    remove_const(:FileTest)
    remove_const(:FileUtils)

    const_set(:Dir,       RealDir)
    const_set(:File,      RealFile)
    const_set(:FileTest,  RealFileTest)
    const_set(:FileUtils, RealFileUtils)
  end
  true
end