fixing FileUtils.mv
This commit is contained in:
parent
2b3132096c
commit
b5e7359eac
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user