Added touch to fileutils

This commit is contained in:
Mark 2009-06-13 00:22:37 -07:00
parent c6d4b3fe5b
commit 27e24b2260
2 changed files with 9 additions and 0 deletions

View File

@ -95,6 +95,10 @@ module FakeFS
def chown_R(user, group, list, options={})
chown(user, group, list, options={})
end
def touch(path)
FileSystem.add(path, MockFile.new)
end
end
class File

View File

@ -446,6 +446,11 @@ class FakeFSTest < Test::Unit::TestCase
assert_equal 'works', File.open('new/nother'){|f| f.read }
end
def test_files_can_be_touched
FileUtils.touch(here("file"))
assert File.exists?(here("file"))
end
def here(fname)
RealFile.expand_path(RealFile.dirname(__FILE__)+'/'+fname)
end