Sha256: c342a35385ec6f0d4c16bbd38b1dd11e9f5b1d1938d240450d52098d348ff9b2
Contents?: true
Size: 820 Bytes
Versions: 29
Compression:
Stored size: 820 Bytes
Contents
module FakeFS class Dir def self.tmpdir RealDir.tmpdir end def self.mkdir(path) FileUtils.mkdir_p(path) end def self.rmdir(path) FileUtils.rm_rf(path) end end class File class << self alias open_with_fail open end def self.open(path, mode = nil, perm = nil, &block) open_with_fail(path, mode, &block) end def self.size(file) self.open(file, 'r') do |f| f.size end end def size @file.content.size end alias read_without_hax read def read(length = nil) if length @position ||= 0 data = @file.content[@position, length] @position += length data else read_without_hax end end def rewind @position = 0 end end end
Version data entries
29 entries across 29 versions & 1 rubygems