FileUtils.mv should raise error on missing file

This commit is contained in:
Jeff Hodges 2009-05-30 22:04:17 -07:00
parent 45b0e2828f
commit 2b3132096c
2 changed files with 8 additions and 0 deletions

View File

@ -32,6 +32,8 @@ module FakeFS
if target = FileSystem.find(src)
FileSystem.add(dest, target.entry)
FileSystem.delete(src)
else
raise Errno::ENOENT, src
end
end

View File

@ -259,4 +259,10 @@ class FakeFSTest < Test::Unit::TestCase
r = File.open('foo','w'){|f| f.write 'bar'; f.flush }
assert_equal 'foo', r.path
end
def test_mv_should_raise_error_on_missing_file
assert_raise(Errno::ENOENT) do
FileUtils.mv 'blafgag', 'foo'
end
end
end