Add File.symlink as an alias for FileUtils.ln_s

This commit is contained in:
Scott Taylor 2009-09-30 01:26:52 -04:00
parent 34a88c4e63
commit 7e927d8ff0
2 changed files with 12 additions and 0 deletions

View File

@ -123,6 +123,10 @@ module FakeFS
0 0
end end
def self.symlink(source, dest)
FileUtils.ln_s(source, dest)
end
def self.stat(file) def self.stat(file)
File::Stat.new(file) File::Stat.new(file)
end end

View File

@ -618,6 +618,14 @@ class FakeFSTest < Test::Unit::TestCase
assert_equal 'works', File.open('new/nother') { |f| f.read } assert_equal 'works', File.open('new/nother') { |f| f.read }
end end
def test_can_symlink_through_file
FileUtils.touch("/foo")
File.symlink("/foo", "/bar")
assert File.symlink?("/bar")
end
def test_files_can_be_touched def test_files_can_be_touched
FileUtils.touch('touched_file') FileUtils.touch('touched_file')
assert File.exists?('touched_file') assert File.exists?('touched_file')