fixing FileUtils.mv

This commit is contained in:
Jeff Hodges 2009-05-30 23:24:29 -07:00
parent 2b3132096c
commit b5e7359eac
2 changed files with 7 additions and 1 deletions

View File

@ -30,7 +30,7 @@ module FakeFS
def mv(src, dest)
if target = FileSystem.find(src)
FileSystem.add(dest, target.entry)
FileSystem.add(dest, target.entry.clone)
FileSystem.delete(src)
else
raise Errno::ENOENT, src

View File

@ -265,4 +265,10 @@ class FakeFSTest < Test::Unit::TestCase
FileUtils.mv 'blafgag', 'foo'
end
end
def test_mv_actually_works
File.open('foo', 'w') {|f| f.write 'bar' }
FileUtils.mv 'foo', 'baz'
assert_equal 'bar', File.open('baz'){|f| f.read }
end
end